Part Number Hot Search : 
CSDC24 NTXV1 HSS4148 PMEG1030 NTXV1 MC1413 SPI35N10 075N15N
Product Description
Full Text Search
 

To Download ST6391 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ST6391, st6392, st6393 st6395, st6397, st6399 data sheet .com .com .com .com 4 .com u datasheet
use in life support devices or systems must be expressly authorized. sgs-thomson products are not authorized for use as critical components in life support devices or sys- tems without the express written approval of sgs-thomson microelectronics. as used herein : 1. life support devices or systems are those which (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform, when prop- erly used in accordance with instructions for use pro- vided with the product, can be reasonably expected to result in significant injury to the user. 2. a critical component is any component of a life support device or system whose failure to perform can reason- ably be expected to cause the failure of the life support device or system, or to affect its safety or effectiveness. .com .com .com .com .com 4 .com u datasheet
st639x datasheet index pages ST6391, st6392, st6393 st6395, st6397, st6399 ............................... 1 general description . . . . . . . . . . . . .......................... 3 pindescription ......................................... 5 st639x core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 memory spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 interrupt . . . .......................................... 17 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 wait & stop modes . . . . . . . . . . . . . . . . ....................... 23 on-chip clock oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 hardware activated digital watchdog function . . . . . . ............. 31 serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6-bit pwm d/a converters . . . . . . . . . . . . . . . . ................... 41 afc a/d comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 dedicated latches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 42 on-screen display (osd) . . . . . ............................... 43 software description . . . . . ................................ 52 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 ordering information table . . . . . . . . . . . . . . . . . . . . . ............ 64 ? .com .com .com .com .com 4 .com u datasheet
.com .com .com .com .com 4 .com u datasheet
? 8-bit hcmos mcus for tv frequency synthesis with osd ST6391, st6392, st6393 st6395, st6397, st6399 4.5 to 6v supply operating range 8mhz maximum clock frequency user program rom: up to 20140 bytes reserved test rom:up to 340 bytes data rom: user selectable size data ram: 256 bytes data eeprom: up to 384 bytes 42-pin shrink dual in line plastic package up to 23 software programmable general pur- pose inputs/outputs, including 2 direct led driving outputs two timers each including an 8-bit counter with a 7-bit programmable prescaler digital watchdog function serial peripheral interface (spi) supporting s-bus/ i 2 c bus and standard serial protocols spi for external frequency synthesis tuning up to six 6-bit pwm d/a converters afc a/d converter with 0.5v resolution five interrupt vectors (irin/nmi, timer 1 & 2, vsync, pwr int.) on-chip clock oscillator 5 lines by 15 characters on-screen display generator with 128 characters all rom types are supported by pin-to-pin eprom and otp versions. the development tool of the st639x microcon- trollers consists of the st638x-emu emulation and development system to be connected via a standard rs232 serial line to an ms-dos per- sonal computer. this is preliminary information from sgs-thomson. details are subject to change without notice. october 1993 (ordering information at the end of the datasheet) 1 psdip42 preliminary data device rom (bytes) eeprom (bytes) ST6391 16k 128 st6392 20k 128 st6393 16k 128 st6395 20k 384 st6397 20k 384 st6399 16k 128 device summary 1/64 .com .com .com .com .com 4 .com u datasheet
pc0 (scl) 12 11 10 9 pb2 pb1 da5 8 7 6 5 da4 da3 4 3 2 1 21 22 pa7 reset oscin oscout 23 24 25 26 27 28 pa5 pa6 test osdoscin osdoscout 29 30 31 32 33 34 35 pc7 36 37 38 41 42 va00339 13 14 15 16 17 18 19 20 v ss da0 39 pc1 (sda) 40 da2 da1 v dd pc2 pc3 (sen) pc4 pc5 pc6 (irin) vsync hsync blank b g r pa4 pa3 pa2 pa0 pa1 afc pb4 pb5 pb6 figure 1. st6393/97 pin configuration pc0 (scl) 12 11 10 9 pb2 pb1 pb0 8 7 6 5 62.5khz out da3 4 3 2 1 21 22 pa7 (hd1) reset oscin oscout 23 24 25 26 27 28 pa5 pa6 (hd0) test osdoscin osdoscout 29 30 31 32 33 34 35 pc7 36 37 38 41 42 va00340 13 14 15 16 17 18 19 20 v ss da0 39 pc1 (sda) 40 da2 da1 v dd pc2 pc3 (sen) pc4 (pwrin) pc5 pc6 (irin) vsync hsync blank b g r pa4 pa3 pa2 pa0 pa1 pb3 pb4 pb5 pb6 figure 2. st6392/99 pin configuration pc0 (scl) 12 11 10 9 pb2 pb1 pb0 8 7 6 5 da4 da3 4 3 2 1 21 22 pa7 (hd1) reset oscin oscout 23 24 25 26 27 28 pa5 pa6 (hd0) test osdoscin osdoscout 29 30 31 32 33 34 35 pc7 36 37 38 41 42 va00337 13 14 15 16 17 18 19 20 v ss da0 39 pc1 (sda) 40 da2 da1 v dd pc2 pc3 (sen) pc4 (pwrin ) pc5 pc6 (irin) vsync hsync blank b g r pa4 pa3 pa2 pa0 pa1 pb3 pb4 pb5 pb6 (1) figure 3. ST6391/95 pin configuration note 1. st6395 only ? ST6391,92,93,95,97,99 2/64 .com .com .com .com .com 4 .com u datasheet
general description the st639x microcontrollers are members of the 8- bit hcmos st638x family, a series of devices spe- cially oriented to tv applications. different rom size and peripheral configurations are available to give the maximum application and cost flexibility. all st639x members are based on a building block ap- proach:a common core is surrounded by a combina- tion of on-chip peripherals (macrocells) available from a standard library. these peripherals are de- signed with the same core technology providing full compatibility and short design time. many of these macrocells are specially dedicated to tv applica- tions. the macrocells of the st639x family are: two timer peripherals each including an 8-bit counter with a 7-bit software programmable prescaler (timer), a digital hardware activated watchdog function (dhwd), a 14-bit voltage synthesis tuning peripheral, a serial peripheral interface (spi), up to six 6-bit pwm d/a converters, an afc a/d con- verter with 0.5v resolution, an on-screen display (osd) with 15 characters per line and 128 charac- ters (in two banks each of 64 characters). in addi- tion the following memory resources are available: program rom (up to 20k), data ram (256 bytes), eeprom (up to 384 bytes). refer to pin configura- tions figures and to st639x device summary (ta- ble 1) for the definition of st639x family members and a summary of differences among the different types. ? ST6391,92,93,95,97,99 3/64 .com .com .com .com .com 4 .com u datasheet
stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 pc d/aoutputs timer 2 ir interrupt input test timer 1 port c port b port a afc input on-screen display digital watchdog/timer serial peripheral interface v dd v ss oscin oscout reset r, g, b, blank hsync, vsync vr01753g pa0 - pa7 * da0 - da5 irin/pc6 test afc pb0 - pb7 * pc2, pc4 - pc7 * pc0 / scl pc1 / sda pc3 / sen power supply oscillator reset 8-bit core user program rom up to 20 kbytes data rom user selectable data eeprom 384 bytes data ram 256 bytes * refer to pin configuration for additional information figure 4. ST6391,92,93, 95,97,99 block diagram device rom (bytes) ram (bytes) eeprom (bytes) afc d/a colour pins low power in reset pwrin pin spi clk freq. (khz) 62.5khz pin emulating devices ST6391 16k 256 128 no 5 3 no no 62.5 no st63e91 st6392 20k 256 128 no 4 3 yes yes 62.5 yes st63e92 st6393 16k 256 128 yes 6 3 no no 62.5 no st63e93 st6395 20k 256 384 no 5 3 no yes 100 no st63e95 st6397 20k 256 384 yes 6 3 no no 100 no st63e97 st6399 16k 256 128 no 4 3 yes yes 62.5 yes st63e99 table 1. device summary ? ST6391,92,93,95,97,99 4/64 .com .com .com .com .com 4 .com u datasheet
pin description v dd and v ss . power is supplied to the mcu using these two pins. v dd is power and v ss is the ground connection. oscin, oscout. these pins are internally con- nected to the on-chip oscillator circuit. a quartz crystal or a ceramic resonator can be connected between these two pins in order to allow the cor- rect operation of the mcu with various stabil- ity/cost trade-offs. the oscin pin is the input pin, the oscout pin is the output pin. reset. the active low reset pin is used to start the microcontroller to the beginning of its program. additionally the quartz crystal oscillator will be dis- abled when the reset pin is low to reduce power consumption during reset phase (st6392/99 only). test. the test pin must be held at v ss for nor- mal operation. pa0-pa7. these 8 lines are organized as one i/o port (a). each line may be configured as either an input with or without pull-up resistor or as an output under software control of the data direction regis- ter. pins pa4 to pa7 are configured as open-drain outputs (12v drive). on pa4-pa7 pins the input pull-up option is not available while pa6 and pa7 have additional current driving capability (25ma, v ol :1v). pa0 to pa3 pins are configured as push- pull. pb0-pb2, pb4-pb6. these 6 lines are organized as one i/o port (b). each line may be configured as either an input with or without internal pull-up resis- tor or as an output under software control of the data direction register. pc0-pc7. these 8 lines are organized as one i/o port (c). each line may be configured as either an input with or without internal pull-up resistor or as an output under software control of the data direc- tion register. pins pc0 to pc3 are configured as open-drain (5v drive) in output mode while pc4 to pc7 are open-drain with 12v drive and the input pull-up options does not exist on these four pins. pc0, pc1 and pc3 lines when in output mode are aandedo with the spi control signals and are all open-drain. pc0 is connected to the spi clock sig- nal (scl), pc1 with the spi data signal (sda) while pc3 is connected with spi enable signal (sen, used in s-bus protocol). pin pc4 and pc6 can also be inputs to software programmable edge sensitive latches which can generate interrupts; pc4 can be connected to power interrupt while pc6 can be connected to the irin/nmi interrupt line. da0-da5. these pins are the six pwm d/a out- puts of the 6-bit on-chip d/a converters. these lines have open-drain outputs with 12v drive. the output repetition rate is 31.25khz (with 8mhz clock). afc. this is the input of the on-chip 10 levels com- parator that can be used to implement the afc function. this pin is an high impedance input able to withstand signals with a peak amplitude up to 12v. osdoscin, osdoscout. these are the on screen display oscillator terminals. an oscillation capacitor and coil network have to be connected to provide the right signal to the osd. hsync, vsync. these are the horizontal and vertical synchronization pins. the active polarity of these pins to the osd macrocell can be selected by the user as rom mask option. if the device is specified to have negative logic inputs, then these signals are low the osd oscillator stops. if the de- vice is specified to have positive logic inputs, then when these signals are high the osd oscillator stops. r, g, b, blank . outputs from the osd. r, g and b are the color outputs while blank is the blank- ing output. all outputs are push-pull. the active po- larity of these pins can be selected by the user as rom mask option. 62.5khz out. this pin is available only on the st6392/99. the pin is an open drain (12v) output at the frequency of 62.5khz (with an 8mhz clock). the pin can be used to drive the sgs-thomson tea5640 chroma processor. refer to the tea5640 data sheet for more information. ? ST6391,92,93,95,97,99 5/64 .com .com .com .com .com 4 .com u datasheet
pin function description da0 to da5 output, open-drain, 12v afc input, high impedance, 12v r,g,b, blank output, push-pull hsync, vsync input, pull-up, schmitt trigger osdoscin input, high impedance osdoscout output, push-pull test input, pull-down oscin input, resistive bias, schmitt trigger to reset logic only oscout output, push-pull reset input, pull-up, schmitt trigger input pa0-pa3 i/o, push-pull, software input pull-up, schmitt trigger input pa4-pa5 i/o, open-drain, 12v, no input pull-up, schmitt trigger input pa6-pa7 i/o, open-drain, 12v, no input pull-up, schmitt trigger input, high drive pb0-pb6 i/o, push-pull, software input pull-up, schmitt trigger input pc0-pc3 i/o, open-drain, 5v , software input pull-up, schmitt trigger input pc4-pc7 i/o, open-drain, 12v, no input pull-up, schmitt trigger input v dd ,v ss power supply pins 62.5khz out output, open-drain 12v table 2. pin summary ? ST6391,92,93,95,97,99 6/64 .com .com .com .com .com 4 .com u datasheet
st639x core the core of the st639x family is implemented inde- pendently from the i/o or memory configuration. consequently, it can be treated as an independent centralprocessor communicating with i/o and mem- ory via internal addresses, data, and control busses. the in-core communication is arranged as shown in the following block diagram figure; the controller being externally linked to both the reset and the os- cillator, while the core is linked to the dedicated on- chip macrocells peripherals via the serial data bus and indirectly for interrupt purposes through the control registers. registers the st639x family core has five registers and three pairs of flags available to the programmer. they are shown in figure 5 and are explained in the following paragraphs together with the pro- gram and data memory page registers. accumulator (a). the accumulator is an 8-bit gen- eral purpose register used in all arithmetic calcula- tions, logical operations, and data manipulations. the accumulator is addressed in the data space as ram location at the ffh address. accordingly, the st639x instruction set can use the accumulator as any other register of the data space. figure 5. st639x core block diagram short direct addressing mode v register w register program counter six levels stack register c c c z z z normal flags interrupt flags nmi flags index register va000423 b7 b7 b7 b7 b7 b0 b0 b0 b0 b0 b0 b11 accumulator y reg. pointer x reg. pointer figure 6. st639x core programming model ? ST6391,92,93,95,97,99 7/64 .com .com .com .com .com 4 .com u datasheet
st639x core (continued) indirect registers (x, y). these two indirect reg- isters are used as pointers to the memory locations in the data space. they are used in the register-in- direct addressing mode.these registers can be addressed in the data space as ram locations at the 80h (x) and 81h (y) addresses. they can also be accessed with the direct, short direct, or bit di- rect addressing modes. accordingly, the st639x instruction set can use the indirect registers as any other register of the data space. short direct registers (v, w). these two regis- ters are used to save one byte in short direct ad- dressing mode. these registers can be addressed in the data space as ram locations at the 82h (v) and 83h (w) addresses. they can also be ac- cessed with the direct and bit direct addressing modes. accordingly, the st639x instruction set can use the short direct registers as any other reg- ister of the data space. program counter (pc) the program counteris a 12-bit register thatcontains the address of the next rom location to be proc- essed by the core. this rom location may be an op- code, an operand, or an address of operand. the 12-bit length allows the direct addressing of 4096 bytes in the program space. nevertheless, if the pro- gram space contains more than 4096 locations, the further program space can be addressed by using the program rom page register. the pc value is incremented, after it is read for the address of the current instruction, by sending it through the alu, so giving the address of the next byte in the program. to execute relative jumps the pc and the offset val- ues are shifted through the alu, where they will be added, and the result is shifted back into the pc. the program counter can be changed in the following ways: jp (jump) instruction.... pc= jump address call instruction ........... pc=call address relative branch instructions ................... pc=pc+offset interrupt........................ pc=interrupt vector reset............................ pc=reset vector ret & reti instructions............pc=pop (stack) normal instruction ........ pc= pc+1 when call or interrupt request occurs stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 program counter when ret or reti occurs va000424 figure 7. stack operation flags (c, z) the st639x core includes three pairs of flags that correspond to 3 different modes: normal mode, in- terrupt mode and non-maskable-interrupt-mode. each pair consists of a carry flag and a zero flag. one pair (cn, zn) is used during normal op- eration, one pair is used during the interrupt mode (ci,zi) and one is used during the not-maskable in- terrupt mode (cnmi, znmi). the st639x core uses the pair of flags that corre- sponds to the actual mode: as soon as an interrupt (resp. a non-maskable-interrupt) is generated, the st639x core uses the interrupt flags (resp. the nmi flags) instead of the normal flags. when the reti in- struction is executed, the normal flags (resp. the inter- rupt flags) are restored if the mcu was in the normal mode (resp. in the interrupt mode) before the interrupt. should be observed that each flag set can only be ad- dressed in its own routine (not-maskable interrupt, normal interrupt or main routine). the interrupt flags are not cleared during the context switching and so, theyremain in the state they were at the exit of the last routine switching. the carry flag is set when a carry or a borrow oc- curs during arithmetic operations, otherwise it is cleared. the carry flag is also set to the value of the bit tested in a bit test instruction, and partici- pates in the rotate left instruction. the zero flag is set if the result of the last arithmetic or logical operation was equal to zero, otherwise it is cleared. the switching between these three sets is auto- matically performed when an nmi, an interrupt and a reti instructions occur. as the nmi mode is automatically selected after the reset of the mcu, the st639x core uses at first the nmi flags. ? ST6391,92,93,95,97,99 8/64 .com .com .com .com .com 4 .com u datasheet
st639x core (continued) stack the st639x core includes true lifo hardware stack that eliminates the need for a stack pointer. the stack consists of six separate 12-bit ram lo- cations that do not belong to the data space ram area. when a subroutine call (or interrupt request) occurs, the contents of each level is shifted into the next level while the content of the pc is shifted into the first level (the value of the sixth level will be lost). when subroutine or interrupt return occurs (ret or reti instructions), the first level register is shifted back into the pc and the value of each level is shifted back into the previous level. these two operating modes are described in figure 7. since the accumulator, as all other data space registers, is not stored in this stack the handling of this regis- ters shall be performed inside the subroutine. the stack pointer will remain in its deepest position, if more than 6 calls or interrupts are executed, so that the last return address will be lost. it will also remain in its highest position if the stack is empty and a ret or reti is executed. in this case the next instruction will be executed. memory registers the prpr can be addressed like a ram location in the data space at the cah address; neverthe- less it is a write-only register that can not be ac- cessed with single-bit operations. this register is used to select the 2-kbyte rom bank of the pro- gram space that will be addressed. the number of the page has to be loaded in the prpr. the prpr is not cleared during the mcu initialization and should therefore be defined before jumping out of the static page. refer to the program space de- scription for additional information concerning the use of this register. the prpr is not modified when an interrupt or a subroutine occurs. prpr program rom page register (cah, write only) d7 d6 d5 d4 d3 d2 d1 d0 figure 8. program rom page register drbr data ram bank register (e8h, write only) d7 d6 d5 d4 d3 d2 d1 d0 figure 9. data ram bank register drwr data rom window register (c9h, write only) d7 d6 d5 d4 d3 d2 d1 d0 figure 10. data rom window register the drbr can be addressed like a ram location in the data space at the e8h address, neverthe- less it is write-only register that can not be ac- cessed with single-bit operations. this register is used to select the desired 64-byte ram/eeprom bank of the data space. the number of the bank has to be loaded in the drbr and the instruction has to point to the selected location as it was in the 0 bank (from 00h address to 3fh address). this register is undefined after reset. refer to the data space description for additional information. the drbr register is not modified when a interrupt or a subroutine occurs. the drwr register can be addressedlike a ram lo- cation in the data space at the c9h address, never- theless it is write-only register that can not be accessed with single-bit operations. this register is used to move up and down the 64-byte read-only data window (from the 40h address to 7fh address of the data space) along the rom of the mcu by step of 64 bytes. the effective address of the byte to be read as a data in the rom is obtainedby the con- catenationof the 6 less significant bits of the address given in the instruction (as less significant bits) and the content of the drwr (as most significant bits). refer to the data space description for additional in- formation. ? ST6391,92,93,95,97,99 9/64 .com .com .com .com .com 4 .com u datasheet
memory spaces the mcus operate in three different memory spaces: stack space, program space, and data space. a description of these spaces is shown in figure 11. stack space the stack space consists of six 12 bit registers that are used for stacking subroutine and interrupt return addressesplus the current programcounterregister. program space the program space is physically implemented in the rom and includes all the instructions that are to be executed, as well as the data required for the immediate addressing mode instructions, the re- served test area and user vectors. it is addressed thanks to the 12-bit program counter register (pc register) and so, the st639x core can directly ad- dress up to 4k bytes of program space. neverthe- less, the program space can be extended by the addition of 2-kbyte rom banks as it is shown in figure 13 in which a 20k bytes memory is de- scribed. these banks are addressed by pointing to the 000h-7ffh locations of the program space thanks to the program counter, and by writing the appropriate code in the program rom page reg- ister (prpr) located at the cah address of the data space. because interrupts and common sub- routines should be available all the time only the lower 2k byte of the 4k program space are bank switched while the upper 2k byte can be seen as static space. table 3 gives the different codes that allows the selection of the corresponding banks. note that, from the memory point of view, the page 1 and the static page represent the same physical memory: it is only a different way of addressing the same location. on the st6392,95,97, a total of 2048, bytes of rom have been implemented; 20140 are available as user rom while 340 are re- served for testing. program space vr001568 interru pt & reset vectors accumulator wregister ram data rom window ram / eeprom banking area data space data ram bank select data rom window select v re gister y r egister x re gister 0-63 00 00h 07ffh 08 00h 0ff0h 0fffh 000h 03fh 040h 070h 080h 081h 082h 083h 084h 0ffh 0c0 h rom rom stack leve l 1 stack leve l 2 stack leve l 3 stack leve l 4 stack leve l 5 stack leve l 6 program counter stack space figure 11. st639x memory addressing description diagram program counter space 0000h 4fffh 0fffh static page page 1 0800h 07ffh page 0 page 1 static page page 9 0000h figure 12. st639x 20k bytes program space addressing description ? ST6391,92,93,95,97,99 10/64 .com .com .com .com .com 4 .com u datasheet
d7-d5. these bits are not used. prpr4-prpr0. these are the program rom banking bits and the value loaded selects the cor- responding page to be addressed in the lower part of 4k program address space as specified in table 3. this register is undefined on reset. note. the number of bits implemented depends on the size of the rom of the device. only the lower part of address space has been bank- switched because interrupt vectors and common subroutines should be available all the time. the reason of this structure is due to the fact that it is not possible to jump from a dynamic page to an- other, unless jumping back to the static page, changing contents of prpr, and, than, jumping to a different dynamic page. care is required when handling the prpr as it is write only. for this reason, it is not allowed to change the prpr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. anyway, this opera- tion may be necessary if the sum of common rou- tines and interrupt drivers will take more than 2k bytes; in this case could be necessary to divide the prpr program rom page register (cah, write only) d7 d6 d5 d4 d3 d2 d1 d0 prpr0 prpr1 prpr2 prpr3 unused figure 13. program rom page register prpr3 prpr2 prpr1 prpr0 pc11 memory page xxxx1 static page (page 1) 00000 page 0 00010 page 1 (static page) 00100 page 2 00110 page 3 01000 page 4 01010 page 5 01100 page 6 01110 page 7 10000 page 8 10010 page 9 table 3. st639x program rom page register coding memory spaces (continued) interrupt driver in a (minor) part in the static page (start and end), and in the second (major) part in one dynamic page. if it is impossible to avoid the writing of this register in interrupts drivers, an im- age of this register must be saved in a ram loca- tion, and each time the program writes the prpr it writes also the image register. the image register must be written first, so if an interrupt occurs be- tween the two instructions the prpr is not af- fected. ? ST6391,92,93,95,97,99 11/64 .com .com .com .com .com 4 .com u datasheet
rom page device address description page 0 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh reserved user rom page 3 0000h-000fh 0010h-07ffh reserved user rom page 4 0000h-000fh 0010h-07ffh reserved user rom page 5 0000h-000fh 0010h-07ffh reserved user rom page 6 0000h-000fh 0010h-07ffh reserved user rom page 7 0000h-000fh 0010h-07ffh reserved user rom (end of 16k ST6391,93,99) page 8 0000h-000fh 0010h-07ffh reserved user rom page 9 0000h-000fh 0010h-07ffh reserved user rom (end of 20k st6392,95,97) table 4. st639x program rom map (up to 20k bytes) memory spaces (continued) ? ST6391,92,93,95,97,99 12/64 .com .com .com .com .com 4 .com u datasheet
b7 b0 000h data ram/eeprom/osd bank area 03fh 040h data rom window area 07fh x register 080h y register 081h v register 082h w register 083h 084h data ram 0bfh port a data register 0c0h port b data register 0c1h port c data register 0c2h reserved 0c3h port a direction register 0c4h port b direction register 0c5h port c direction register 0c6h reserved 0c7h interrupt option register 0c8h data rom window register 0c9h program rom page register 0cah reserved 0cbh spi data register 0cch 0cdh reserved 0d1h timer 1 prescaler register 0d2h timer 1 counter register 0d3h timer 1 status/control reg. 0d4h 0d5h reserved 0d7h watchdog register 0d8h figure 14. st639x data space b7 b0 reserved 0d9h timer 2 prescaler register 0dah timer 2 counter register 0dbh timer 2 status control reg. 0dch 0ddh reserved 0dfh da0 data/control register 0e0h da1 data/control register 0e1h da2 data/control register 0e2h da3 data/control register 0e3h afc, ir & osd result register 0e4h outputs control register 0e5h da4 data/control register 0e6h da5 data/control register 0e7h data ram bank register 0e8h dedic. latches control reg. 0e9h eeprom control register 0eah spi control register 1 0ebh spi control register 2 0ech osd charac. bank select reg. 0edh 0f0h reserved 0feh accumulator 0ffh osd control registerslocated in page 6 of banked data ram vertical start address reg. 010h horizontalstart address reg. 011h vertical space register 012h horizontal space register 013h background colour register 014h global enableregister 017h figure 15. st639x data space (continued) memory spaces (continued) data space the instruction set of the st639x core oper- ates on a specific space, named data space tha t contains all the data necessary for the processing of the program. the data space al- lows the addressing of ram (256 bytes for the st639x family), eeprom (up to 384 bytes), st639x core/peripheralregisters, and read-only data such asconstantsand the look-up tables. ? ST6391,92,93,95,97,99 13/64 .com .com .com .com .com 4 .com u datasheet
memory spaces (continued) data rom addressing. all the read-only data are physically implemented in the rom in which the pro- gram space is also implemented. the rom therefore containsthe program to be executedand also the con- stants and the look-up tables needed for the program. the locationsof data space in which the differentcon- stants and look-up tables are addressed by the st639x core can be considered as being a 64-byte window through which it is possible to access to the read-only data stored in the rom. this window is lo- cated from the 40h address to the 7fh address in the data space and allows the direct reading of the bytes from the 000h address to the 03fh address in the rom. all the bytes of the rom can be used to store either instructions or read-only data. indeed,the win- dow can be moved by step of 64 bytes along the rom in writing the appropriate code in the write-only data rom window register (drwr, location c9h). the ef- fective address of the byte to be read as a data in the rom is obtained by the concatenation of the 6 less significant bits of the address in the data space (as less significant bits) and the content of the drwr (as most significant bits). so when addressing location 40h of data space, and 0 is loaded in the drwr, the physical addressed location in rom is 00h. note. the data rom window cannot address win- dows above the 16k byte range. dwr data rom window register (c9h, write only) d7 d6 d5 d4 d3 d2 d1 d0 dwr0 = data rom window 0 dwr1 = data rom window 1 dwr2 = data rom window 2 dwr3 = data rom window 3 dwr4 = data rom window 4 dwr5 = data rom window 5 dwr6 = data rom window 6 dwr7 = data rom window 7 figure 16. data rom window register data rom window register contents data space address 40h-7fh in instruction program space address 65432 0 543210 543210 read 1 6 7 8 9 10 11 01 vr01573b 12 1 0 data space address 59h 0 0 0 0 0 1 00 1 1 1 example: (dwr) dwr=28h 11 0000 00 00 1 rom address:a19h 11 13 0 1 7 0 0 figure 17. data rom window memory addressing dwr7-dwr0. these are the data rom window bits that correspond to the upper bits of data rom program space. this register is undefined after re- set. note. care is required when handling the drwr as it is write only. for this reason, it is not allowed to change the drwr contents while executing inter- rupts drivers, as the driver cannot save and than re- store its previous content. if it is impossible to avoid the writing of this register in interrupts drivers, an im- age of this register must be saved in a ram location, and each time the program writes the drwr it writes also the image register. the image register must be written first, so if an interrupt occurs be- tween the two instructions the drwr register is not affected. ? ST6391,92,93,95,97,99 14/64 .com .com .com .com .com 4 .com u datasheet
drbr data ram bank register (e8h, write only) d7 d6 d5 d4 d3 d2 d1 d0 drbr0 drbr1 drbr2 drbr3 drbr4 drbr5 drbr6 drbr7 figure 18. data ram bank register memory spaces (continued) data ram/eeprom/osd ram addressing in all members of the st639x family 64 bytes of data ram are directly addressablein the data space from 80h to bfh addresses. the additional 192 bytes of ram, the 384 bytes of eeprom , and the osd ram can be addressed using the banks of 64 bytes located between addresses 00h and 3fh. the selection of the bank is done by programming the data ram bank register (drbr) located at the e8h address of the data space. in this way each bank of ram, eeprom or osd ram can se- lect 64 bytes at a time. no more than one bank should be set at a time. drbr value selection hex. binary 01h 0000 0001 eeprom page 0 all devices 02h 0000 0010 eeprom page 1 03h 0000 0011 eeprom page 2 st6395 and st6397 only 81h 1000 0001 eeprom page 3 82h 1000 0010 eeprom page 4 83h 1000 0011 eeprom page 5 04h 0000 0100 ram page 2 all devices 08h 0000 1000 ram page 3 10h 0001 0000 ram page 4 20h 0010 0000 osd page 5 40h 0100 0000 osd page 6 table 5. data ram bank register set-up drbr7,drbr1,drbr0. these bits select the eeprom pages. drbr6, drbr5. each of these bits, when set, will select one osd ram register page. drbr4,drbr3,drbr2. each of these bits, when set, will select one ram page. this register is undefined after reset. table 5 summarizes how to set the data ram bank register in order to select the various banks or pages. note : care is required when handling the drbr as it is write only. for this reason, it is not allowed to change the drbr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. if it is impossible to avoid the writing of this register in interrupts driv- ers, an image of this register must be saved in a ram location, and each time the program writes the drbr it writes also the image register. the image register must be written first, so if an in- terrupt occurs between the two instructions the drbr is not affected. ? ST6391,92,93,95,97,99 15/64 .com .com .com .com .com 4 .com u datasheet
memory spaces (continued) eecr eeprom control register (eah, read/write) d7 d6 d5 d4 d3 d2 d1 d0 en = eeprom enable bit bs = eeprom busy bit pe = parallel mode enable bit ps = parallel start bit reserved (must be set low) reserved (must be set low) sb = stand-by enable bit unused figure 19. eeprom control register eeprom description the data space of st639x family from 00h to 3fh is paged as described in table 5. 384 bytes of eeprom located in six pages of 64 bytes (pages 0,1,2,3,4 and 5, see table 5). through the programming of the data ram bank register (drbr=e8h) the user can select the bank or page leaving unaffected the way to ad- dress the static registers. the way to address the adynamico page is to set the drbr as described in table 5 (e.g. to select eeprom page 0, the drbr has to be loaded with content 01h, see data ram/eeprom/osd ram addressing for addi- tional information). bits 0, 1 and 7 of the drbr are dedicated to the eeprom. the eeprom pages do not require dedicated in- structions to be accessed in reading or writing. the eeprom is controlled by the eeprom control register (eecr=eah). any eeprom location can be read just like any other data location, also in terms of access time. to write an eeprom location takes an average time of 5 ms (10ms max) and during this time the eeprom is not accessible by the core. a busy flag can be read by the core to know the eeprom status before trying any access. in writing the eeprom can work in two modes: byte mode (bmode) and parallel mode (pmode). the bmode is the normal way to use the eeprom and consists in accessing one byte at a time. the pmode consists in accessing 8 bytes per time. d7. not used sb. write only . if this bit is set the eeprom is disabled (any access will be meaningless) and the power consumption of the eeprom is reduced to the leakage values. d5, d4. reserved for testing purposes, they must be set to zero. ps. set only . once in parallel mode, as soon as the user software sets the ps bit the parallel writing of the 8 adjacent registers will start. ps is internally reset at the end of the programming procedure. note that less than 8 bytes can be written; after parallel programming the remaining undefined bytes will have no particular content. pe. write only . this bit must be set by the user program in order to perform parallel program- ming (more bytes per time). if pe is set and the aparallel start bito (ps) is low, up to 8 adjacent bytes can be written at the maximum speed, the content being stored in volatile registers. these 8 adjacent bytes can be considered as row, whose a7, a6, a5, a4, a3 are fixed while a2, a1 and a0 are the changing bytes. pe is automatically reset at the end of any parallel programming procedure. pe can be reset by the user software before starting the programming procedure, leaving unchanged the eeprom registers. bs. read only . this bit will be automatically set by the core when the user program modifies an eeprom register. the user program has to test it before any read or write eeprom operation; any attempt to access the eeprom while abusy bito is set will be aborted and the writing procedure in pro- gress completed. en . write only. this bit must be set to one in order to write any eeprom register. if the user program will attempt to write the eeprom when en= a0o the involved registers will be unaffected and the abusy bito will not be set. after reset the contentof eecr register will be 00h. notes : when the eeprom is busy (bs=a1o) the eecr can not be accessed in write mode, it is only possi- ble to read bs status. this implies that as long as the eeprom is busy it is not possible to change the status of the eeprom control register. eecr bits 4 and 5 are reserved for test purposes, and must never be set to a1o. ? ST6391,92,93,95,97,99 16/64 .com .com .com .com .com 4 .com u datasheet
memory spaces (continued) interrupt the st639x core can manage 4 different mask- able interrupt sources, plus one non-maskable in- terrupt source (top priority level interrupt). each source is associated with a particular interrupt vec- tor that contains a jump instruction to the related interrupt service routine. each vector is located in the program space at a particular address (see table 6). when a source provides an interrupt re- quest, and the request processing is also enabled by the st639x core, then the pc register is loaded with the address of the interrupt vector (i.e. of the jump instruction). finally, the pc is loaded with the address of the jump instruction and the interrupt routine is processed. the relationship between vector and source and the associated priority is hardware fixed for the dif- ferent st639x devices. for some interrupt sources it is also possible to select by software the kind of event that will generate the interrupt. all interrupts can be disabled by writing to the gen bit (global interrupt enable) of the interrupt option register (address c8h). after a reset, st639x is in non maskable interrupt mode, so no interrupts will be accepted and nmi flags will be used, until a reti instruction is executed. if an interrupt is exe- cuted, one special cycle is made by the core, dur- ing that the pc is set to the related interrupt vector address. a jump instruction at this address has to redirect program execution to the beginning of the related interrupt routine. the interrupt detecting cy- cle, also resets the related interrupt flag (not avail- able to the user), so that another interrupt can be stored for this current vector, while its driver is un- der execution. if additional interrupts arrive from the same source, they will be lost. nmi can interrupt other interrupt routines at any time, while other interrupts cannot interrupt each other. if more than one interrupt is waiting for service, they are executed according to their priority. the lower the number, the higher the priority. priority is, therefore, fixed. interrupts are checked during the last cycle of an instruction (reti included). level sensitive interrupts have to be valid during this period. additional notes on parallel mode. if the user wants to perform a parallel programming the first action should be the set to one the pe bit; from this moment the first time the eeprom will be ad- dressed in writing, the row address will be latched and it will be possible to change it only at the end of the programming procedure or by reset- ting pe without programming the eeprom. after the row address latching the core can aseeo just one eeprom row (the selected one) and any at- tempt to write or read other rows will produce er- rors. do not read the eeprom while pe is set. as soon as pe bit is set, the 8 volatile row latches are cleared. from this moment the user can load data in the whole row or just in a subset. ps set- ting will modify the eeprom registers correspond- ing to the row latches accessed after pe. for example, if the software sets pe and accesses eeprom in writing at addresses 18h,1ah,1bh and then sets ps, thesethree registers will be modified at the same time; the remaining bytes will have no par- ticular content. note that pe is internally reset at the end of the programming procedure. this implies that the user must set pe bit between two parallel pro- gramming procedures. anyway the user can set and then reset pe without performing any eeprom pro- gramming. ps is a set only bit and is internally reset at the end of the programming procedure. note that if the user tries to set ps while pe is not set there will not be any programming procedure and the ps bit will be unaffected. consequently ps bit can not be set if en is low. ps can be affected by the user set if, and only if, en and pe bits are also set to one. ? ST6391,92,93,95,97,99 17/64 .com .com .com .com .com 4 .com u datasheet
interrupt vectors/sources the st639x core includes 5 different interrupt vectors in order to branch to 5 different interrupt routines. the interrupt vectors are located in the fixed (or static) page of the program space. the interrupt vector associated with the non-mask- able interrupt source is named interrupt vector #0. it is located at the (ffch,ffdh) addresses in the program space. this vector is associated with the pc6/irin pin. the interrupt vectors located at addresses (ff6h,ff7h), (ff4h,ff5h), (ff2h,ff3h), (ff0h,ff1h) are named interrupt vectors #1, #2, #3 and #4 respectively. these vectors are associ- ated with timer 2 (#1), vsync (#2), timer 1 (#3) and pc4(pwrin) (#4). interrupt priority the non-maskable interrupt request has the high- est priority and can interrupt any other interrupt routines at any time, nevertheless the other inter- rupts cannot interrupt each other. if more than one interrupt request is pending, they are processed by the st639x core according to their priority level: vector #1 has the higher priority while vector #4 the lower. the priority of each interrupt source is hard- ware fixed. interrupt option register the interrupt option register (ior register, loca- tion c8h) is used to enable/disable the individual interrupt sources and to select the operating mode of the external interrupt inputs. this register can be addressed in the data space as ram location at the c8h address, nevertheless it is write-only reg- ister that can not be accessed with single-bit op- erations. the operating modes of the external interrupt inputs associated to interrupt vectors #1 and #2 are selected through bits 4 and 5 of the ior register. d7. not used. el1. this is the edge/level selection bit of inter- rupt #1. when set to one, the interrupt is generated on low level of the related signal; when cleared to zero, the interrupt is generated on falling edge. the bit is cleared to zero after reset. es2. this is the edge selection bit on interrupt #2. this bit is used on the st639x devices with on-chip osd generator for vsync detection. gen. this is the global enable bit. when set to one all interrupts are globally enabled;when this bit is cleared to zero all interrupts are disabled (excluding nmi). d3 - d0. these bits are not used. inte rrupt source associated vector vector address pc6/irin pin (1) interrup t vector # 0 (nmi) 0ffch-0ffdh timer 2 interrup t vector # 1 0ff6h-0ff7h vsync interrup t vector # 2 0ff4h-0ff5h timer 1 interrup t vector # 3 0ff2h-0ff3h pc4/pwrin interrup t vector # 4 0ff0h-0ff1h note 1. this pin is associated with the nmi interrupt vector table 6. interrupt vectors/sources relationships interrupt (continued) ior interr upt option register (c8h, write only) d7 d6 d5 d4 d3 d2 d1 d0 unuse d gen = global enab le bit es2 = edge selection bit el1 = edge level selection bit unuse d figure 20. interrupt option register ? ST6391,92,93,95,97,99 18/64 .com .com .com .com .com 4 .com u datasheet
interrupt procedure the interrupt procedure is very similar to a call pro- cedure; the user can consider the interrupt as an asynchronous call procedure. as this is an asyn- chronous event the user does not know about the context and the time at which it occurred. as a re- sult the user should save all the data space regis- ters which will be used inside the interrupt routines. there are separate sets of processor flags for nor- mal, interrupt and non-maskable interrupt modes which are automatically switched and so these do not need to be saved. the following list summarizes the interrupt proce- dure (refer also to figure 21. interrupt processing flow chart): - interrupt detection - the flags c and z of the main routine are ex- changed with the flags c and z of the interrupt routine (resp. the nmi flags) - the value of the pc is stored in the first level of the stack - the normal interrupt lines are inhib- ited (nmi still active) - the edge flip-flop is reset - the related interrupt vector is loaded in the pc. - user selected registers are saved inside the in- terrupt service routine (normally on a software stack) - the source of the interrupt is found by polling (if more than one source is associated to the same vector) - interrupt servicing - return from interrupt (reti) - automatically the st639x core switches back to the normal flags (resp the interrupt flags) and pops the previous pc value from the stack the interrupt routine begins usually by the identifi- cation of the device that has generated the inter- rupt request. the user should save the registers which are used inside the interrupt routine (that holds relevant data) into a software stack. after the reti instruction execution, the core car- ries out the previous actions and the main routine can continue. st639x interrupt details ir interrupt (#0). the irin/pc6 interrupt is con- nected to the first interrupt #0 (nmi, 0ffch). if the irint interrupt is disabled at the latch circuitry, then it will be high. the #0 interrupt input detects a high to low level. note that once #0 has been latched, then the only way to remove the latched #0 signal is to service the interrupt. #0 can interrupt the other interrupts. a simple latch is provided from the pc6(irin) pin in order to generate the irint signal. this latch can be triggered by either the positive or negative edge of irin signal. irint is inverted with respect to the latch. the latch can be read by software and reset by software. interrupt (continued) load pc from interrupt vector ( ff c / ffd ) set inte rrupt mas k push the pc into the stac k select internal mode flag check if there is an interrupt reques t and inte rrupt mask instruction wa s the inst ruction areti is the core already in normal mode ? fe tch inst ruction ex ecute inst ruction clea r interrupt mas k select program fla gs o pop o the stack ed pc no no yes ye s ? ? no yes va000014 figure 21. interrupt processing flow-chart ? ST6391,92,93,95,97,99 19/64 .com .com .com .com .com 4 .com u datasheet
interrupt (continued) timer 2 interrupt (#1). the timer 2 interrupt is connectedto the interrupt #1 (0ff6h). the timer 2 interrupt generatesa low level (which is latchedin the timer). only the low level selection for #1 can be used. bit 6 of the interrupt option register c8h has to be set. vsync interrupt (#2). the vsync interrupt is connected to the interrupt #2. when disabled the vsync int signal is low. the vsync int signal is inverted with respect to the signal applied to the vsync pin. bit 5 of the interrupt option register c8h is used to select the negative edge (es2=0) or the positive edge (es2=1); the edge will depend on the application. note that once an edge has been latched, then the only way to remove the latched signal is to service the interrupt. care must be taken not to generate spurious interrupts. this interrupt may be used for synchronize to the vsync signal in order to change characters in the osd only when the screen is on vertical blanking (if desired). this method may also be used to blink characters. timer 1 interrupt (#3). the timer 1 interrupt is connected to the fourth interrupt #3 (0ff2h) which detects a low level (latched in the timer). pwr interrupt (#4). the pwr interrupt is con- nected to the fifth interrupt #4 (0ff0h). if the pwrint is disabled at the pwr circuitry, then it will be high. the #4 interrupt input detects a low level. a simple latch is provided from the pc4 (pwrin)pin in order to generate the pwrint sig- nal. this latch can be triggered by either the posi- tive or negative edge of the pwrin signal. pwrint is inverted with respect to the latch. the latch can be reset by software. notes global disable does not reset edge sensi- tive interrupt flags. these edge sensitive interrupts become pending again when global disabling is re- leased. moreover, edge sensitive interrupts are stored in the related flags also when interrupts are globally disabled, unless each edge sensitive inter- rupt is also individually disabled before the inter- rupting event happens. global disable is done by clearing the gen bit of interrupt option register, while any individual disable is done in the control register of the peripheral. the on-chip timer pe- ripherals have an interrupt r equestflag bit (tmz), this bit is set to one when the device wants to generate an interrupt request and a mask bit (eti) that must be set to one to allow the transfer of the flag bit to the core. ? ST6391,92,93,95,97,99 20/64 .com .com .com .com .com 4 .com u datasheet
va000200 to st6 reset st6 internal reset oscillator signal watchdog reset v dd 300k reset (active low) counter 1.0k figure 22. internal reset circuit reset the st639x devices can be reset in two ways: by the external reset input (reset) tied low and by the hardware activated digital watchdog peripheral. reset input the external active low reset pin is used to reset the st638x devices and provide an orderly software startup procedure. the activation of the reset pin may occur at any time in the run or wait mode. even short pulses at the reset pin will be accepted since the reset signal is latched internally and is only cleared after 2048 clocks at the oscillator pin. the clocks from the oscillator pin to the reset circuitry are buffered by a schmitt trigger so that an oscillator in start-up conditions will not give spurious clocks. when the reset pin is held low, the external crystal os- cillator is also disabled in order to reduce current con- sumption. the mcu is configured in the reset mode as long as the signal of the reset pin is low. the processing of the programis stopped and the standard input/outputports (port a, port b and port c) are in the input state. as soon as the level on the reset pin be- comes high, the initialization sequence is executed. refer to the mcu initialization sequence for additional information. watchdog reset the st639x devices are provided with an on-chip hardware activated digital watchdog function in or- der to provide a graceful recovery from a software upset. if the watchdog register is not refreshed and the end-of-count is reached, then the reset state will be latched into the mcu and an internal circuit pulls down the reset pin. this also resets the watchdog which subsequently turns off the pull- down and activates the pull-up device at the reset pin. this causes the positive transition at the reset pin. the mcu will then exit the reset state after 2048 clocks on the oscillator pin. application notes an external resistor between v dd and the reset pin is not required because an internal pull-up device is provided. the user may prefer to add an external pull-up resistor. an internal power-on device does not guarantee that the mcu will exit the reset state when v dd is above 4.5v and therefore the reset pin should be externally controlled. ? ST6391,92,93,95,97,99 21/64 .com .com .com .com .com 4 .com u datasheet
reset is reset still present ? yes no va000427 nmi mask set int latch cleared ( if present ) select nmi mode flags put ffeh on address bus load pc from reset locations ffe / fff fetch instruction figure 23. reset & interrupt processing flow-chart jp reset vector initialization routine jp: 2 bytes/4 cycles reti: 1bytes/2 cycles reti va 000181 reset figure 24. restart initialization program flow-chart mcu initialization sequence when a reset occurs the stack is reset to program counter, the pc is loaded with the address of the reset vector (located in the program rom at ad- dresses ffeh & fffh). a jump instruction to the beginning of the program has to be written into these locations. after a reset the interrupt mask is automatically activated so that the core is in non- maskable interrupt mode to prevent false or ghost interrupts during the restart phase. therefore the restart routine should be terminated by a reti in- struction to switch to normal mode and enable in- terrupts. if no pending interrupt is present at the end of the reset routine, the st639x will continue with the instruction after the reti; otherwise the pending interrupt will be serviced. reset low power mode (st6392 and st6399 only) when the reset pin is low, the quartz oscillator is disabled allowing reduced current consumption. when the reset pin is raised the quartz oscillator is enabled and oscillations will start to build up.the internal reset circuitry will count 2048 clocks on the oscillator pin before allowing the mcu to go out of the reset state; the clocks are after a schmitt trigger so that false or multiple counts are not possible. reset (continued) ? ST6391,92,93,95,97,99 22/64 .com .com .com .com .com 4 .com u datasheet
wait & stop modes the stop and wait modes have been imple- mented in the st639x core in order to reduce the consumption of the device when the latter has no instruction to execute. these two modes are de- scribed in the following paragraphs. on st639x as the hardware activated digital watchdog function is present the stop instruction is de-activated and any attempt to execute it will cause the automatic execution of a wait instruction. wait mode the configuration of the mcu in the wait mode oc- curs as soon as the wait instruction is executed. the microcontroller can also be considered as being in a asoftware frozeno state where the core stops processing the instructions of the routine, the con- tents of the ram locations and peripheral registers are saved as long as the power supply voltage is higher than the ram retention voltage but where the peripheralsare still working. the wait mode is used when the user wants to re- duce the consumption of the mcu when it is in idle, while not losing count of time or monitoring of exter- nal events. the oscillator is not stopped in order to provide clock signal to the peripherals. the timers counting may be enabled (writing the psi bit in tscr register) and the timer interrupt may be also enabled before entering the wait mode; this allows the wait mode to be left when timer interrupt oc- curs. if the exit from the wait mode is performed with a general reset (either from the activation of the external pin or by watchdog reset) the mcu will enter a normal reset procedure as described in the reset chapter. if an interrupt is generated during wait mode the mcu behaviour depends on the state of the st639x core before the initialization of the wait sequence, but also of the kind of the in- terrupt request that is generated. this case will be described in the following paragraphs.in any case, the st639x core does not generate any delay af- ter the occurrence of the interrupt because the os- cillator clock is still available. stop mode on st639x the hardware watchdog is present and the stop instruction has been de-activated. any attempt to execute a stop will cause the automat- ic execution of a wait instruction. exit from wait mode the following paragraphs describe the output pro- cedure of the st639x core from wait mode when an interrupt occurs. it must be noted that the restart sequence depends on the original state of the mcu (normal, interrupt or non-maskable interrupt mode) before the start of the wait sequence, but also of the type of the interrupt request that is gen- erated. in all cases the gen bit of ior has to be set to 1 in order to restart from wait mode. contrary to the operation of nmi in the run mode, the nmi is masked in wait mode if gen=0. normal mode. if the st639x core was in the main routine when the wait instruction has been executed, the st6398xcore outputsfrom the wait mode as soon as any interrupt occurs; the related interrupt routine is executed and at the end of the interruptservice routine the instruction that follows the wait instruction is exe- cuted if no other interrupts are pending. non-maskable interrupt mode. if the wait in- struction has been executed during the execution of the non-maskable interrupt routine, the st639x core outputs from the wait mode as soon as any interrupt occurs: the instruction that follows the wait instruction is executed and the st639x core is still in the non-maskable interrupt mode even if another interrupt has been generated. normal interrupt mode. if the st639x core was in the interrupt mode before the initialization of the wait sequence, it outputs from the wait mode as soon as any interrupt occurs. nevertheless, two cases have to be considered: if the interrupt is a normal interrupt, the inter- rupt routine in which the wait was entered will be completed with the execution of the instruc- tion that follows the wait and the st639x core is still in the interrupt mode. at the end of this routine pending interrupts will be serviced in accordance to their priority. if the interrupt is a non-maskable interrupt, the non-maskable routine is processed at first. then, the routine in which the wait was en- tered will be completed with the execution of the instruction that follows the wait and the st639x core is still in the normal interrupt mode. notes : if all the interrupt sources are disabled, the restart of the mcu can only be done by a reset activation. the wait instruction is not executed if an enabled interrupt request is pending. in the st639x the hardware activated digital watchdog function is present. as the watchdog is always activated the stop instruction is de-activated and any attempt to execute the stop instruction will cause an exe- cution of a wait instruction. ? ST6391,92,93,95,97,99 23/64 .com .com .com .com .com 4 .com u datasheet
on-chip clock oscillator the internal oscillator circuit is designed to require a minimum of external components. a crystal quartz, a ceramic resonator, or an external signal (provided to the oscin pin) may be used to gener- ate a system clock with various stability/cost trade- offs. the typical clock frequency is 8mhz. please note that different frequencies will affect the operation of those peripherals (d/as, spi) whose reference fre- quencies are derived from the system clock. the different clock generator options connection methods are shown in figures 25 and 26. one ma- chine cycle takes 13 oscillator pulses; 12 clock pulses are needed to increment the pc while and additional 13th pulse is needed to stabilize the inter- nal latches during memory addressing. this means that with a clock frequency of 8mhz the machine cy- cle is 1.625 m s. the crystal oscillator start-up time is a function of many variables: crystal parameters (especially rs), oscillator load capacitance (cl), ic parameters, am- bient temperature, and supply voltage.it must be ob- served that the crystal or ceramic leads and circuit connections must be as short as possible. typical values for cl1 and cl2 are in the range of 15pf to 22pf but these should be chosen based on the crys- tal manufacturers specification. typical input capaci- tance for oscin and oscout pins is 5pf. the oscillator output frequency is internallydivided by 13 to produce the machine cycle and by 12 to produce the timer and the watchdog clock. a byte cycle is the smallest unit needed to execute any operation (i.e., increment the program counter). an instruction may need two, four, or five byte cycles to be executed (see table 7). instruc tion type cycles execution time branch if set/reset 5 cycles 8.125 m s branch & subroutine branch 4 cycles 6.50 m s bit manipulation 4 cycles 6.50 m s load instruction 4 cycles 6.50 m s arithmetic & logic 4 cycles 6.50 m s conditional branch 2 cycles 3.25 m s program control 2 cycles 3.25 m s table 7. intructions timing with 8mhz clock figure 25. clock generator option (1) figure 26. clock generator option (2) figure 27. oscin, oscout diagram ? ST6391,92,93,95,97,99 24/64 .com .com .com .com .com 4 .com u datasheet
input/output ports the st639x microcontrollers use three standard i/o ports (a,b,c) with up to eight pins on each port; refer to the device pin configurations to see which pins are available. each line can be individually programmed either in the input mode or the output mode as follows by software. - output - input with on-chip pull-up resistor (selected by software) - input without on-chip pull-up resistor (selected by software) note: pins with 12v open-drain capability do not have pull-up resistors. in output mode the following hardware configura- tions are available: - open-drain output 12v (pa4-pa7, pc4-pc7) - open-drain output 5v (pc0-pc3) - push-pull output (pa0-pa3, pb0-pb6) the lines are organized in three ports (port a,b,c). the ports occupy 6 registers in the data space. each bit of these registers is associated with a par- ticular line (for instance, the bits 0 of the port a data and direction registers are associated with the pa0 line of port a). there are three data registers (dra, drb, drc), that are used to read the voltage level values of the lines programmed in the input mode, or to write the logic value of the signal to be output on the lines configured in the output mode. the port data reg- isters can be read to get the effective logic levels of the pins, but they can be also written by the user software, in conjunction with the related data di- rection register, to select the different input mode options. single-bit operations on i/o registers (bit set/reset instructions) are possible but care is nec- essary because reading in input mode is made from i/o pins and therefore might be influenced by the external load, while writing will directly affect the port data register causing an undesired changes of the input configuration. the three data direction registers (ddra, ddrb, ddrc) allow the selection of the direction of each pin (input or output). all the i/o registers can be read or written as any other ram location of the data space, so no extra ram cell is needed for port data storing and ma- nipulation. during the initialization of the mcu, all the i/o registers are cleared and the input mode with pull-up is selected on all the pins thusavoiding pin conflicts(with the exception of pc2 that is set in output mode and is set high ie. high impedance). details of i/o ports when programmed as an input a pull-up resistor (if available) can be switched active under program control. when programmed as an output the i/o port will operate either in the push-pull mode or the open-drain mode according to the hardware fixed configuration as specified below. port a. pa0-pa3 are available as push-pull when outputs. pa4-pa7 are available as open-drain (no push-pull programmability) capable of withstand- ing 12v (no resistive pull-up in input mode). pa6- pa7 has been specially designed for higher driving capability and are able to sink 25ma with a maxi- mum v ol of 1v. port b. all lines are configured as push-pull when outputs. port c. pc0-pc3 are available as open-drain ca- pable of withstanding a maximum v dd +0.3v. pc4- pc7 are available as open-drain capable of withstanding 12v (no resistive pull-up in input mode). some lines are also used as i/o buffers for signals coming from the on-chip spi. in this case the final signal on the output pin is equivalent to a wired and with the programmed data output. if the user needs to use the serial peripheral, the i/o line should be set in output mode while the open-drain configuration is hardware fixed; the corresponding data bit must set to one. if the latched interrupt functions are used (irin, pwrin) then the corresponding pins should be set to input mode. on st639x the i/o pins with double or special functions are: - pc0/scl (connected to the spi clock signal) - pc1/sda (connected to the spi data signal) - pc3/sen (connected to the spi enable signal) - pc4/pwrin (connected to the pwrin inter- rupt latch) - pc6/irin (connected to the irin interrupt latch) all the port a,b and c i/o lines have schmitt-trig- ger input configuration with a typical hysteresis of 1v. ? ST6391,92,93,95,97,99 25/64 .com .com .com .com .com 4 .com u datasheet
pa7-pa0. these are the i/o port a data bits. reset at power-on. pb7-pb0. these are the i/o port b data bits. reset at power-on. pc7-pc0. set to 04h at power-on. bit 2 (pc2 pin) is set to one (open drain therefore high im- pedence). pa7-pa0. these are the i/o port a data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pb7-pb0. these are the i/o port b data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pc7-pc0. these are the i/o port c data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. set to 04h at power-on. bit 2 (pc2 pin) is set to one (output mode se- lected). ddr dr mode option 0 0 input with on-chip pull-up resistor 0 1 input without on-chip pull-up resistor 1 x output open-drain or push-pull note : x: means don't care. table 8. i/o port options selection dra, drb, drc port a, b, c data register ( c0h pa, c1h pb, c2h pc read/ write ) d7 d6 d5 d4 d3 d2 d1 d0 a0 - pa7 = data bits pb0 - pb7 = data bits pc0 - pc7 = data bits figure 28. port a, b, c data register ddra, ddrb,ddrc port a, b, c data direction register ( c4h pa, c5h pb, c6h pc read/ write ) d7 d6 d5 d4 d3 d2 d1 d0 pa0 - pa7 = data direction bits pb0 - pb7 = data direction bits pc0 - pc7 = data direction bits a0o defines bit as inpu t o1o defines bit as outpu t figure 29. port a, b, c data register i/o pin programming each pin can be individually programmed as input or output with different input and output configurations. this is achieved by writing to the relevant bit in the data (dr) and data direction register (ddr). table 8 shows all the port configurations that can be se- lected by the user software. input/output ports (continued) ? ST6391,92,93,95,97,99 26/64 .com .com .com .com .com 4 .com u datasheet
figure 30. i/o configuration diagram (open drain 12v) figure 31. i/o configuration diagram (open drain 5v, push-pull) input/output configurations the following schematics show the i/o lines hard- ware configuration for the different options. figure 30 shows the i/o configuration for an i/o pin with open-drain 12v capability (standard drive and high drive). figure 31 shows the i/o configuration for an i/o pin with push-pull and with open drain 5v capa- bility. notes : the wait instruction allows the st639x to be used in situations where low power consumption is needed. this can only be achieved however if the i/o pins either are programmed as inputs with well defined logic levels or have no power consuming resistive loads in output mode. as the same die is used for the different st639x versions the unavail- able i/o lines of st639x should be programmed in output mode. single-bit operations on i/o registers are possible but care is necessary because reading in input mode is made from i/o pins while writing will di- rectly affect the port data register causing an unde- sired changes of the input configuration. input/output ports (continued) ? ST6391,92,93,95,97,99 27/64 .com .com .com .com .com 4 .com u datasheet
timers the st639x devices offer two on-chip timer periph- erals consisting of an 8-bit counter with a 7-bit pro- grammable prescaler, thus giving a maximum count of 2 15 , and a control logic that allows configuring the peripheral operating mode. figure 32 shows the timer block diagram. the content of the 8-bit count- ers can be read/written in the timer/counter regis- ters tcr that can be addressed in the data space as ram location at addresses d3h (timer 1) and dbh (timer 2). the state of the 7-bit prescaler can be read in the psc register at addresses d2h (timer 1) and dah (timer 2). the control logic is managed by tscr registers at d4h (timer 1) and dch (timer 2) addresses as described in the following paragraphs. the following description applies to both timer 1 and timer 2. the 8-bit counter is decrement by the output (rising edge) coming from the 7-bit pres- caler and can be loaded and read under program control. when it decrements to zero then the tmz (timer zero) bit in the tscr is set to one. if the eti (enable timer interrupt) bit in the tscr is also set to one an interrupt request, associated to interrupt vector #3 (for timer 1) and #1 for timer 2, is gener- ated. the interrupt of the timer can be used to exit the mcu from the wait mode. the prescaler decrements on rising edge. the prescaler input is the oscillator frequency divided by 12. depending on the division factor programmed by ps2/ps1/ps0 (see table 9) bits in the tscr, the clock input of the timer/counter register is multi- plexed to different sources. on division factor 1, the clock input of the prescaler is also that of timer/counter; on factor 2, bit 0 of prescaler register is connectedto the clock input of tcr. this bit changes its state with the half frequency of prescaler clock input. on factor 4, bit 1 of psc is connected to clock input of tcr, and so on. on di- vision factor 128, the msb bit 6 of psc is con- nected to clock input of tcr. the prescaler initialize bit (psi) in the tscr register must be set to one to allow the prescaler (and hence the counter) to start. if it is cleared to zero then all of the prescaler bits are set to one and the counter is inhibited from counting. the prescaler can be given any value between 0 and 7fh by writing to the related register address, if bit psi in the tscr register is set to one. the tap of the prescaler is selected using the ps2/ps1/ps0 bits in the control register. figure 33 shows the timer working principle. figure 32. timer peripheral block diagram ? ST6391,92,93,95,97,99 28/64 .com .com .com .com .com 4 .com u datasheet
timers (continued) timer operating modes as on st639x devices the external timer pin is not available the only allowed operating mode is the out- put mode that have to be selected by setting to 1 bit 4 and by clearing to 0 bit 5 in the tscr1 register. this procedurewill enable both timer 1 and timer 2. output mode (tscr1 d4 = 1, tscr1 d5 = 0). on this mode the timer prescaler is clocked by the prescaler clock input (osc/12). the user can se- lect the desired prescaler division ratio through the ps2/ps1/ps0 bits. when tcr count reaches 0, it sets the tmz bit in the tscr. the tmz bit can be tested under program control to perform timer functions whenever it goes high. bit d4 and d5 on tscr2 (timer 2) register are not implemented. timer interrupt when the counter register decrements to zero and the software controlled eti (enable timer interrupt) bit is set to one then an interrupt request associ- ated to interrupt vector #3 (for timer 1) and to inter- rupt vector #1 (for timer 2) is generated. when the counter decrements to zero also the tmz bit in the tscr register is set to one. figure 33. timer working principle notes : tmz is set when the counter reaches 00h ; how- ever, it may be set by writing 00h in the tcr regis- ter or setting the bit 7 of the tscr register. tmz bit must be cleared by user software when servic- ing the timer interrupt to avoid undesired interrupts when leaving the interrupt service routine. after re- set, the 8-bit counter register is loaded to ffh while the 7-bit prescaler is loaded to 7fh , and the tscr register is cleared which means that timer is stopped (psi=0) and timer interrupt disabled. a write to the tcr register will predominate over the 8-bit counter decrement to 00h function, i.e. if a write and a tcr register decrement to 00h occur simultaneously, the write will take precedence, and the tmz bit is not set until the 8-bit counter reaches 00h again. the values of the tcr and the psc registers can be read accurately at any time. ? ST6391,92,93,95,97,99 29/64 .com .com .com .com .com 4 .com u datasheet
ps2 ps1 ps0 divided by 000 1 001 2 010 4 011 8 10016 10132 11064 1 1 1 128 table 9. prescaler division factors tscr imer 1&2 status control registers dah timer 1, dch timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 ps0 = prescaler mux. select ps1 = prescaler mux. select ps2 = prescaler mux. select psi = prescaler initialize bit d4 = timers enable bit * d5 = timers enable bit * eti = enable timer inte rrupt tmz = timer zero bit * only available in tscr1 figure 34. timer status control registers timers (continued) tmz. low-to-high transition indicates that the timer count register has decrement to zero. this bit must be cleared by user software before to start with a new count. eti. this bit, when set, enables the timer interrupt (vector #3 for timer 1, vector #1 for timer 2) request. if eti=0 the timer interrupt is disabled. if eti= 1 and tmz= 1 an interrupt request is generated. d5. this is the timers enable bit d5. it must be cleared to 0 together with a set to 1 of bit d4 to en- able both timer 1 and timer 2 functions. it is not implemented on tscr2 register. d4. this is the timers enable bit d4. this bit must be set to 1 together with a clear to 0 of bit d5 to en- able both timer 1 and timer 2 functions. it is not implemented on tscr2 register. d5 d4 timers 0 0 disabled 0 1 enabled 1 x reserved ps1. used to initialize the prescaler and inhibit its countingwhile psi = 0 the prescaler is set to 7fh and the counter is inhibited. when psi = 1 the prescaler is enabled to count downwards. as long as psi= 0 both counter and prescaler are not running. ps2-ps0. these bits select the division ratio of the prescaler register. (see table 9) the tscr1 and tscr2 registers are cleared on reset. the correct d4-d5 combination must be written in tscr1 by user's software to enable the operation of timer 1 and timer 2. tcr timer counter 1&2 register d3h timer 1, dbh timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 d7 - d0 = counter bits figure 35. timer counter registers psc timerprescaler 1&2 register d2h timer 1, dah timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 d6 - d0 = prescaler bits always read as a0o figure 36. timer counter registers ? ST6391,92,93,95,97,99 30/64 .com .com .com .com .com 4 .com u datasheet
figure 37. hardware activated watchdog block diagram figure 38. hardware activated watchdog working principle hardware activated digital watch- dog function the hardware activated digital watchdog function con- sists of a down counter that is automatically initialized after reset so that this function does not need to be ac- tivated by the user program. as the watchdog function is always activated this down counter can not be used as a timer. the watchdog is using one data space reg- ister (hwdr location d8h). the watchdog register is set to feh on reset and immediately starts to count down, requiring no software start. similarly the hard- ware activated watchdog can not be stopped or de- layed by software. the watchdog time can be programmed using the 6 msbits in the watchdog register, this gives the possi- bility to generate a reset in a time between 3072 to 196608oscillator cycles in 64 possible steps. (with a clock frequency of 8mhz this means from 384 m sto 24.576ms). the reset is prevented if the register is reloaded with the desired value before bits 2-7 de- crement from all zeros to all ones. the presence of the hardware watchdog deactivates the stop instruction and a wait instruction is auto- matically executed instead of a stop. bit 1 of the watchdog register (set to one at reset) can be used to generate a software reset if cleared to zero). figure 37 shows the watchdog block diagram while figure 38 shows its working principle. ? ST6391,92,93,95,97,99 31/64 .com .com .com .com .com 4 .com u datasheet
hwdr hardware activated watchdog register (d8h, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 c = watchdog activation bit sr = software reset bit t1-t6 = counter bits figure 39. watchdog register hardware activated digital watchdog function (continued) t1-t6. these are the watchdog counter bits. it should be noted that d7 (t1) is the lsb of the counter and d2 (t6) is the msb of the counter, these bits are in the opposite order to normal. sr. this bit is set to one during the reset phase and will generate a software reset if cleared to zero. c. this is the watchdog activation bit that is hard- ware set. the watchdog function is always acti- vated independently of changes of value of this bit. the register reset value is feh (bit 1-7 set to one, bit 0 cleared). serial peripheral interface the st639x serial peripheral interface (spi) has been designed to be cost effective and flexible in interfacing the various peripherals in tv applica- tions. it maintains the software flexibility but adds hard- ware configurations suitable to drive devices which require a fast exchange of data. the three pins dedicated for serial data transfer (single master only) can operate in the following ways: - as standard i/o lines (software configuration) - as s-bus or as i 2 cbus (two pins) - as standard (shift register) spi when using the hardware spi, a fixed clock rate of 62.5khz is provided. it has to be noted that the first bit that is output on the data line by the 8-bit shift register is the msb. spi data/control registers for i/o details on scl (serial clock), sda (serial data) and sen (serial enable) please refer to i/o ports description with reference to the following registers: port c data register, address c2h (read/write). - bit d0 asclo - bit d1 asdao - bit d3 aseno port c data direction register, address c6h (read/write). ssdr spi serial data register (cch, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 d0-d7 = data bits figure 40. spi serial data register d7-d0. these are the spi data bits. they can be neither read nor written when spi is operating (busy bit set). they are undefined after reset. ? ST6391,92,93,95,97,99 32/64 .com .com .com .com .com 4 .com u datasheet
d7-d4. these bits are not used. str. this is start bit for i 2 cbus/s-bus. this bit is meaningless when std/spi enable bit is cleared to zero. if this bit is set to one std/spi bit is also set to a1o and spi start generation, before beginning of transmission, is enabled. set to zero after reset. stp. this is stop bit for i 2 cbus/s-bus. this bit is meaningless when std/spi enable bit is cleared to zero. if this bit is set to one std/spi bit is also set to a1o and spi stop condition generation is en- abled. stp bit must be reset when standard proto- col is used (this is also the default reset conditions). set to zero after reset. std, spi enable. this bit, in conjunction with s- bus/i 2 cbus bit, allows the spi disable and will select between i 2 cbus/s-bus and standard shift register protocols. if this bit is set to one, it selects both i 2 cbus and s-bus protocols; final selection between them is made by s- bus/i 2 cbus bit. if this bit is cleared to zero when s-bus/i 2 cbus is set to a1o the standard shift register protocol is selected. if this bit is cleared to a0o when s-bus/i 2 cbus is cleared to 0 the spi is disabled. set to zero after reset. s-bus/i 2 cbus selection. this bit, in conjunction with std/spi bit, allows the spi disable and will select between i 2 cbus and s-bus protocols. if this bit is cleared to a0o when std bit is also a0o, the spi interface is disabled. if this bit is cleared to zero when std bit is set to a1o, the i 2 cbus protocol will be selected. if this bit is set to a1o when std bit is set to a1o, the s-bus protocol will be selected. cleared to zero after reset. scr1 spi control register 1 (ebh, write only) d7 d6 d5 d4 d3 d2 d1 d0 s-bus/i 2 c bus selection std/spi enable stp = stop bit str = start bit unused figure 41. spi control register 1 serial peripheral interface (continued) d7-d4. these bits are not used. tx/rx. write only. when this bit is set, current byte operation is a transmission. when it is reset, cur- rent operation is a reception. set to zero after re- set. vry/s. read only/write only. this bit has two dif- ferent functions in relation to read or write opera- tion. reading operation: when std and/or trx bits is cleared to 0, this bit is meaningless. when bits std and tx are set to 1, this bit is set each time bsy bit is set. this bit is reset during byte op- eration if real data on sda line are different from the output from the shift register. set to zero after reset. writing operation : it enables (if set to one) or disables (if cleared to zero) the interrupt coming from vsync pin. undefined after reset. refer to osd description for additional information. acn. read only. if std bit (d1 of scr1 register) is cleared to zero this bit is meaningless. when std is set to one, this bit is set to one if no acknowledge has been received. in this case it is automatically reset when bsy is set again. set to zero after re- set. bsy. read/set only. this is the busy bit. when a one is loaded into this bit the spi interface start the transmission of the data byte loaded into ssdr data register or receiving and building the receive data into the ssdr data register. this is done in accordance with the protocol, direction and start/stop condition(s). this bit is automatically cleared at the end of the current byte operation. cleared to zero after reset. note : the spi shift register is also the data transmission register and the data received register; this feature is made possible by using the serial structure of the st639x and thus reducing size and complexity. d1 std/sp d0 s-bus/i 2 c bus spi function 0 0 disabled 0 1 std shift reg. 10i 2 c bus 1 1 s-bus table 10. spi modes selection scr2 spi control register 2 (ech, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 bsy = busy bit 0 acn = acknowledge bit vry/s = verify/sync.enab le tx/rx = enable bit unuse d figure 42. spi control register2 ? ST6391,92,93,95,97,99 33/64 .com .com .com .com .com 4 .com u datasheet
during transmission or reception of data, all ac- cess to serial data register is therefore disabled. the reception or transmission of data is started by setting the busy bit to a1o; this will be automat- ically reset at the end of the operation. after reset, the busy bit is cleared to a0o, and the hardware spi disabled by clearing bit 0 and bit 1 of spi control register 1 to a0o. the outputs from the hardware spi are aandedo to the standard i/o software con- trolled outputs. if the hardware spi is in operation the port c pins related to the spi should be config- ured as outputs using the data direction register and should be set high. when the spi is configured as the s-bus, the three pins pc0, pc1 and pc3 become the pins scl, sda and sen respectively. when configured as the i 2 cbus the pins pc0 and pc1 are configured as the pins scl and sda; pc3 is not driven and can be used as a general purpose i/o pin. in the case of the std spi the pins pc0 and pc1 become the signals clock and data, pc3 is not driven and can be used as general pur- pose i/o pin. the verify bit is available when the spi is configured as either s-bus or i 2 cbus. at the start of a byte transmission, the verify bit is set to one. if at any time during the transmission of the following eight bits, the data on the sda line does not match the data forced by the spi (while scl is high), then the verify bit is reset. the verify is available only during transmission for the s-bus and i 2 cbus; for other protocol it is not defined. the sda and scl signal entering the spi are buff- ered in order to remove any minor glitches. when std bit is set to one (s-bus or i 2 cbus selected), and trx bit is reset (receiving data), and stop bit is set (last byte of current communication), the spi interface does not generate the acknowledge, ac- cording to s-bus/i 2 cbus specifications. pco- scl, pc1-sda and pc3-sen lines are standard drive i/o port pins with open-drain output configura- tion (maximum voltage that can be applied to these pins is v dd +0.3v). s-bus/i 2 cbus protocol information the s-bus is a three-wire bidirectional data-bus with functional features similar to the i 2 cbus. in fact the s-bus includes decoding of start/stop conditions and the arbitration procedure in case of multimaster system configuration (the st639x spi allows a single-master only operation). the sda line, in the i 2 cbus represents the and combina- tion of sda and sen lines in the s-bus. if the sda and the sen lines are short-circuit connected, they appear as the sda line of the i 2 cbus. the start/stop conditions are detected (by the external peripherals suited to work with s-bus/i 2 cbus) in the following way: - on s-bus by a transition of the sen line (1 to 0 start, 0 to 1 stop) while the scl line is at high level. -oni 2 cbus by a transition of the sda line (10 start, 01stop) while the scl line is at high level. start and stop condition are always generated by the master (st639x spi can only work as single master). the bus is busy after the start condition and can be considered again free only when a certain time delay is left after the stop condition. in the s- bus configuration the sda line is only allowed to change during the time scl line is low. after the start information the sen line returns to high level and re- mains unchangedfor all the data transmission time. when the transmission is completed the sda line is set to high level and, at the same time, the sen line returns to the low level in order to supply the stop in- formation with a low to high transition, while the scl line is at high level. on the s-bus, as on the i 2 cbus, each eight bit information (byte) is followed by one acknowledged bit which is a high level put on the sda line by the transmitter. a peripheral that ac- knowledges has to pull down the sda line during the acknowledge clock pulse. an addressed receiver has to generate an acknowledge after the reception of each byte; otherwise the sda line remains at the high level during the ninth clock pulse time. in this case the master transmitter can generate the stop condition, via the sen (or sda in i 2 cbus) line, in order to abort the transfer. serial peripheral interface (continued) ? ST6391,92,93,95,97,99 34/64 .com .com .com .com .com 4 .com u datasheet
start/stop acknowledge. the timing specs of the s-bus protocol require that data on the sda (only on this line for i 2 cbus) and sen lines be stable during the ahigho time of scl. two exceptions to this rule are foreseen and they are used to signal the start and stop condition of data transfer. - on s-bus by a transition of the sen line (10 start, 01 stop) while the scl line is at high level. -oni 2 cbus by a transition of the sda line (10 start, 01 stop) while the scl line is at high level. data are transmitted in 8-bit groups; after each group, a ninth bit is interposed, with the purpose of acknowledging the transmitting sequence (the transmit device place a a1o on the bus, the acknow- ledging receiver a a0o). interface protocol. this paragraph deals with the description of data protocol structure. the inter- face protocol includes: - a start condition - a aslave chip addresso byte, transmitted by the master, containing two different information: a. the code identifying the device the master wants to address (this information is present in the first seven bits) b. the direction of transmission on the bus (this information is given in the 8th bit of the byte); a0o means awriteo, that is from the master to the slave, while a1o means areado. the ad- dressed slave must always acknowledge. serial peripheral interface (continued) the sequence from, now on, is different according to the value of r/w bit. 1. r/w = a0o (write) in all the following bytes the master acts as trans- mitter; the sequence follows with: a. an optional data byte to address (if needed) the slave location to be written (it can be a word ad- dress in a memory or a register address, etc.). b. a adatao byte which will be written at the ad- dress given in the previous byte. c. further data bytes. d. a stop condition a data transfer is always terminated by a stop con- dition generated from the master. the st639x pe- ripheral must finish with a stop condition before another start is given. figure 44 shows an example of write operation. 2. r/w = a1o (read) in this case the slave acts as transmitter and, therefore, the transmission direction is changed. in read mode two different conditions can be consid- ered: a. the master reads slave immediately after first byte. in this case after the slave address sent from the master with read condition enabled the master transmitter becomes master re- ceiver and the slave receiver becomes slave transmitter. b. the master reads a specified register or loca- tion of the slave. in this case the first sent byte will contain the slave address with write condi- tion enabled, then the second byte will specify the address of the register to be read. at this moment a new start is given together with the slave address in read mode and the procedure will proceed as described in previous point aao. ? ST6391,92,93,95,97,99 35/64 .com .com .com .com .com 4 .com u datasheet
serial peripheral interface (continued) acknowledge from slave acknowledge from slave acknowledge from slave start r/w stop start r/w stop start stop figure 43.master transmit to slave receiver (write mode) s slave address 0 a word address a data a p acknowledge from slave acknowledge from master no acknowledge from master r/w n bytes figure 44.master reads slave immediately after first byte (read mode) s slave address 1 a data a data 1 p msb msb msb figure 45.master reads after setting slave register address (write address, read data) s slave address 0 a x word address a p acknowledge from slave acknowledge from slave r/w stop start s slave address 1 a data a data 1 p msb msb acknowledge from slave acknowledge from master no acknowledge from master ? ST6391,92,93,95,97,99 36/64 .com .com .com .com .com 4 .com u datasheet
figure 46. s-bus timing diagram serial peripheral interface (continued) s-bus/i 2 cbus timing diagrams the clock of the s-bus/i 2 cbus of the st639x spi (single master only) has a fixed bus clock fre- quency of 62.5khz. all the devices connected to the bus must be able to follow transfers with fre- quencies up to 62.5khz, either by being able to transmit or receive at that speed or by applying the clock synchronization procedure which will force the master into a wait state and stretch low peri- ods. ? ST6391,92,93,95,97,99 37/64 .com .com .com .com .com 4 .com u datasheet
serial peripheral interface (continued) figure 47. i 2 c bus timing diagram note: the third pin, sen, should be high; it is not used in the i 2 cbus. logically sda is the and of the s-bus sda and sen.) ? ST6391,92,93,95,97,99 38/64 .com .com .com .com .com 4 .com u datasheet
serial peripheral interface (continued) compatibility s-bus/i 2 cbus using the s-bus protocol it is possible to imple- ment mixed system including s-bus/i 2 cbus bus peripherals. in order to have the compatibility with the i 2 cbus peripherals, the devices including the s-bus interface must have their sda and sen pins connected together as shown in the following figure 48 (a and b). it is also possible to use mixed s-bus/i 2 cbus protocols as showed in figure 46 (c). s-bus peripherals will only react to s-bus protocol signals, while i 2 cbus peripherals will only react to i 2 cbus signals. multimaster configu- ration is not possible with the st63xx spi (single master only). (a) (b) (c) figure 48.s-bus/i 2 c bus mixed configurations ? ST6391,92,93,95,97,99 39/64 .com .com .com .com .com 4 .com u datasheet
serial peripheral interface (continued) figure 49.sofware bus (hardware bus disabled) timing diagram std spi protocol (shift register) this protocol is similar to the i 2 cbus with the ex- ception that there is no acknowledge pulse and there are no stop or start bits. the clock cannot be slowed down by the externalperipherals. in this case all three outputs should be high in or- der not to lock the software i/os from functioning. spi standard bus protocol: the standard bus protocol is selected by loading the spi control register 1 (scr1 add. ebh). bit 0 named i 2 c must be set at one and bit 1 named std mut be reset. when the standard bus protocol is selected bit 2 of the scr1 is meaningless. this bit named stop bit is used only in i 2 cbus or sbus. however take care thet the stop bit must be reset when the standard pro- tocol is used. this bit is set to zero after re- set. ? ST6391,92,93,95,97,99 40/64 .com .com .com .com .com 4 .com u datasheet
6-bit pwm d/a converters the d/a macrocell contains up to six pwm d/a outputs (31.25khz repetition, da0-da5) with six bit resolution. each d/a converter of st639x is composed by the following main blocks: - pre-divider - 6-bit counter - data latches and compare circuits the pre-divider uses the clock input frequency (8mhz typical) and its output clocks the 6-bit free- running counter. the data latched in the six regis- ters (e0h, e1h, e2h, e3h, e6h and e7h) control the six d/a outputs (da0,1,2, 3, 4 and 5). when all ze- ros are loaded the relevant output is an high logic level; all 1's correspond to a pulse with a 1/64 duty cycle and almost 100% zero level. the repetition frequency is 31.25khz and is related to the 8mhz clock frequency. use of a different os- cillator frequency will result in a different repetition frequency. all d/a outputs are open-drain with standard current drive capability and able to with- stand up to 12v. da0-da5. these are the 6 bits of the pwm digital to analog converter. undefined after reset. afc a/d comparator afc a/d input,ir/pc6 result, vsync result the afc macrocell contains an a/d comparator with five levels at intervals of 1v from 1v to 5v. the levels can all be lowered by 0.5v to effectively dou- ble the resolution. a/d comparator the a/d used to perform the afc function (when high threshold is selected) has the following volt- age levels: 1,2,3,4 and 5v. bits 0-2 of afc result register (e4h address) will provide the result in bi- nary form (less than 1v is 000, greater than 5v is 101). if the application requires a greater resolution, the sensitivity can be doubled by clearing to zero bit 2 of the outputs control register, address e5h. in this case all levels are shifted lower by 0.5v. if the two results are now added within a software rou- tine then the a/d s-curve can be located within a resolution of 0.5v. the a/d input has high impedance able to with- stand up to 13v signals (input level tolerances 200mv absolute and 100mv relative to 5v). da0, da1, da2, da3, da4, da5 da0 to da5 data/control registers (e0h, e1h, e2h, e3h, e6h, e7h write only) d7 d6 d5 d4 d3 d2 d1 d0 data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 unused unused figure 50. da0-da5 data/control registers figure 51.6-bit pwm d/a output configuration figure 52. afc inputs configuration diagram ? ST6391,92,93,95,97,99 41/64 .com .com .com .com .com 4 .com u datasheet
d7-d5. these bits are not used. vsync. this bit reads the status of the vsync pin. it is inverted with respect to the pin. ir. this bit reads the status of the ir latch. if a sig- nal has been latched this bit will be high. ad2-ad0. these bits store the real time conver- sion of the value present on the afc input pin. un- defined reset value. d7, d6, d5, d4, d3, d1, d0. these bits are not used. a/d shift. this bit determines the voltage range of the afc input. writing a zero will select the 0.5v to 4.5v range. writing a one will select the 1.0v to 5.0v range. undefined after reset. afcr afc result register (e4h, read only) d7 d6 d5 d4 d3 d2 d1 d0 ad2-ad0 a/d = conv result ir vsync unused figure 53. afc, ir and osd result register afsr afc shift register (e5h, write only) d7 d6 d5 d4 d3 d2 d1 d0 unused a/d shift bit unused figure 54. outputs control register afc a/d comparator (continued) dedicated latches two latches are available which may generate in- terrupts to the st639x core. the ir latch is set either by the falling or rising edge of the signal on pin pc6(irin). if bit 1 (irposedge) of the latches register (e9h) is high, then the latch will be trig- gered on the rising edge of the signal at pc6(irin). if bit 1 (irposedge) is low, then the latch will be triggered on the falling edge of the signal at pc6(irin). the ir latch can be reset by setting bit 3 (resirlat) of the latches register; the bit is set only and a high should be written every time the ir latch needs to be reset. if bit 2 (irinten) of the latches register (e9h) is high, then the output of the ir latch, irintn, may generate an interrupt (#0). irintn is inverted with respect to the state of the ir latch. if bit 2 (irinten) is low, then the output of the ir latch, irintn, is forced high. the state of the ir latch may be read from bit 3 (irlatch) of register e4h; if the ir latch is set, then bit 3 will be high. the pwr latch is set either by the falling or rising edge of the signal on pin pc4(pwrin). if bit 4 (pwredge) of the latches register (e9h) is high, then the latch will be triggered on the rising edge of the signal at pc4(pwrin). if bit 4 (pwredge) is low, then the latch will be triggered on the falling edge of the signal at pc4(pwrin). the pwr latch can be reset by setting bit 6 (respwrlat) of the latches register; the bit is set only and a high should be written every time the pwr latch needs to be reset. if bit 5 (pwrinten) of the latches reg- ister (e9h) is high, then the output of the pwr latch, pwrintn, may generate an interrupt (#4). pwrintn is inverted with respect to the state of the pwr latch. if bit 5 (pwrinten) is low, then the output of the pwr latch, pwrintn, is forced high. ? ST6391,92,93,95,97,99 42/64 .com .com .com .com .com 4 .com u datasheet
d7. this bit is not used respwrlat. resets the pwr latch; this bit is set only. pwrinten. this bit enables the pwrint signal (#4) from the latch to the st639x core. undefined after reset. pwredge. the bit determines the edge which will cause the pwrin latch to be set. if this bit is high, than the pwrin latch will be set on the rising edge of the pwrin signal. undefined after reset. resirlat. resets the ir latch; this bit is set only. irinten. this bit enables the irintn signal (#0) from the latch to the st639x core. undefined after reset. irposedge. the bit determines the edge which will cause the ir latch to be set. if this bit is high, than the ir latch will be set on the rising edge of the ir signal. undefined after reset. d0. this bit is not used dlcr dedicated latches control register (e9h, write only) d7 d6 d5 d4 d3 d2 d1 d0 unused irposedge irinten resirlat pwredge pwrinten respwrlat unused figure 55. dedicated latches control register on-screen display (osd) the st639x osd macrocell is a cmos lsi char- acter generator which enable display of characters and symbols on the tv screen. the character rounding function enhances the readability of the characters. the st639x osd receives horizontal and vertical synchronization signal and outputs screen information via r, g, b and blanking pins. the main characteristics of the macrocell are listed below: - number of display characters: 5 lines by 15 columns. - number of character types: 128 characters in two banks of 64 characters. only one bank per screen can be used. - character size: four character heights (18h, 36h 54h, 72h), two heights are available per screen, programmable by line. - character format: 6x9 dots with character rounding function. - character colour: eight colours available pro- grammable by word. - display position: 64 horizontal positions by 2/f osc and 63 vertical positions by 4 h - word spacing: 64 positions programmable from 2/f osc to 128/f osc . - line spacing: 63 positions programmable from 4 to 252 h. - background: no background, square back- ground or fringe background programmable by word. - background colour: two of eight colours avail- able programmable by word. - display output: three character data output terminals (r,g,b) and a blank output terminal. - display on/off: display data may be pro- grammed on or off by word or entire screen. the entire screen may be blanked. format specification the entire display can be turned on or off through the use of the global enable bit or the display may be selectively turned on or off by word. to turn off the entire display, the global enable bit (ge) should be zero. if the global enable is one, the display is controlled by the word enable bits (we). theglobal enable bit is located in the global enable register and the word enable bit is located in the space character preceding the word. dedicated latches (continued) ? ST6391,92,93,95,97,99 43/64 .com .com .com .com .com 4 .com u datasheet
each line must begin with a format character which describes the format of that line and of the first word. this character is not displayed. a space character defines the format of sub- sequent words. a space character is denoted by a one in bit 6 in the display ram. if bit 6 of the display ram is a zero, the other six bits define one of the 64 display characters. the colour, background and enable can be pro- grammed by word. this information is encoded in the space character between words or in the for- mat character at the beginning of each line. five bits define the colour and background of the follow- ing word, and determine whether it will be dis- played or not. characters are stored in a 6 x 9 dot format. one dot is defined vertically as 2h (horizontal lines) and horizontally as 2/f osc if the smallest character size is enabled. there is no space between characters or lines if the vertical space enable (vse) and hori- zontal space enable (hse) bits are both zero. this allows the use of special graphics characters. the normal alphanumeric character set is format- ted to be 5 x 7 with one empty row at the top and one at the bottom and one empty column at the right. if vse and hse are both zero, then the spac- ing between alphanumeric characters is 1 dot and the spacing between lines ofalphanumericcharac- ters is 2h. the character size is programmed by line through the use of the size bit (s) in the format character and the global size bits (gs1 and gs2). the verti- cal spacing enable bit (vse) located in the format character controls the spacing between lines. if this bit is set to one, the spacing between lines is defined by the vertical spacing register, otherwise the spacing between lines is 0. the spacing between words is controlled by the horizontal space enable bit (hse) located in the space character. if this bit is set to one, the spacing between words is defined by the horizontal spacing register, otherwise the space character width of 6 dots is the spacing between words. the formats for the display character, space character and format character are described hereafter. d7. not used. d6. this pin is fixed to a1o. r, g, b. colour. the 3 colour control bits define the colour of the following word as shown in table be- low. space character register colour setting. r g b colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white bgs. background select. the background select bit selects the desired background for thefollowing word. there are two possible backgrounds defined by the bits in the background control register. a0o -the background on the following word is en- abled by bg0 and the colour is set by r0, g0, and b0. a1o -the background on the following word is en- abled by bg1 and the colour is set by r1, g1, and b1. on-screen display (continued) space character format see data ram table description for specific address ( write only) d7 d6 d5 d4 d3 d2 d1 d0 hse = horizontal space enable we = word enable bit bgs = backround select b = b colour bit g = g colour bit r = r colour bit fixed to a1o unuse d figure 56. space character register explanation ? ST6391,92,93,95,97,99 44/64 .com .com .com .com .com 4 .com u datasheet
we. word enable. the word enable bit defines whether or not the following word is displayed. a0o -the word is not displayed. a1o -if the global enable bit is one, then the word is displayed. hse. horizontal space enable. the horizontal space enable bit determines the spacing between words. the space between characters is always 0. the alphanumeric character set is implemented in a 5 x 7 format with one empty column to the right and one empty row above and below so that the space between alphanumeric characters will be one dot. a0o -the space between words is equal to the width of the space character, which is 6 dots. a1o -the space between words is defined by the value in the horizontal space register plus the width of the space character. d7. this bit is not used s. character size. the character size bit, along with the global size bits (gs2 and gs1) located in the horizontal space register, specify the character size for each line as defined in table 11. r, g, b. colour. the 3 colour control bits define the colour of the following word as shown in table 10. bgs. background select. the background select bit selects the desired background for thefollowing word. there are two possible backgrounds defined by the bits in the background control register. a0o- the background on the following word is en- abled by bg0 and the colour is set by r0, g0, and b0. a1o -the background on the following word is en- abled by bg1 and the colour is set by r1, g1, and b1. we. word enable. the word enable bit defines whether or not the following word is displayed. a0o -the word is not displayed. a1o -if the global enable bit is one, then the word is displayed. vse. vertical space enable. the vertical space enable bit determines the spacing between lines. a0o -the space between lines is equal to 0h. the alphanumeric character set is implemented in a 5 x 7 format with one empty column to the right and one empty row above and onebelow and stored in a 6 x 9 format. a1o -the space between lines is defined by the value in the vertical space register. table 10. format character register colour setting. r g b colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white table 11. format character register size setting gs2 gs1 s vertical height horizontal length 0 0 0 18h 6 tdot 0 0 1 36h 12 tdot 0 1 0 18h 6 tdot 0 1 1 54h 18 tdot 1 0 0 36h 12 tdot 1 0 1 54h 18 tdot 1 1 0 36h 12 tdot 1 1 1 72h 24 tdot tdot= 2/f osc d7. this bit is not used. on-screen display (continued) format character see data ram table description for specific address ( write only) d7 d6 d5 d4 d3 d2 d1 d0 vse = vertical space enable we = word enable bit bgs = backround select b = b colour bit g = g colour bit r = r colour bit s = character size control bit unused figure 57. format character register explanation ? ST6391,92,93,95,97,99 45/64 .com .com .com .com .com 4 .com u datasheet
d6. this bit is fixed to a0o. c5-c0. character type. the 6 character type bits define one of the 64 available character types. these character types are shown on the following pages. character types the character set is user defined as rom mask option. register and ram addressing the osd contains seven registers and 80 ram lo- cations. the seven registers are the vertical start address register, horizontal start address regis- ter, vertical space register, horizontal space reg- ister, background control register, global enable register and character bank select register. the global enable register can be written at any time by the st639x core. the other six registers and the ram can only be read or written to if the global enable is zero. the six registers and the ram are located on two pages of the paged memory of the st639x mcus; the character bank select register is located out- side the paged memory at address edh. each page contains 64 memory locations. this paged memory is at memory locations 00h to 3fh in the st639x memory map. a page of memory is en- abled by setting the desired page bit, located in the data ram bank register, to a one. the page reg- ister is location e8h. a one in bit five selects page 5, located on the osd and a one in bit 6 selects page 6 on the osd. table 12 shows the addresses of the osd registers and ram. table 12. osd control registers and data ram addressing page address register or ram 5 00h - 3fh ram locations 00h - 3fh 6 00h - 0fh ram locations 00h - 0fh 6 10h vertical start register 6 11h horizontal start register 6 12h vertical space register 6 13h horizontal space register 6 14h background control register 6 17h global enable register no page edh character bank select register osd global enable register this register contains the global enable bit (ge). it is the only register that can be written at any time regardless of the state of the ge bit. it is a write only register. d7-d1. these bits are not used ge. global enable. this bit allows the entire dis- play to be turned off. a0o - the entire display is disabled. the ram and other registers of the osd can be accessed by the core. a1o - display of words is controlled by the word en- able bits (we) located in the format or space character. the other registers and ram can- not be accessed by the core. on-screen display (continued) display character see data ram table description for specific addresses ( write only) d7 d6 d5 d4 d3 d2 d1 d0 c5-c0 = character types control bit fixed to a0o unused figure 58. display character register explanation global enable register 17h - page 6 ( write only) d7 d6 d5 d4 d3 d2 d1 d0 ge = global enable bit unuse d figure 59. global enable bit ? ST6391,92,93,95,97,99 46/64 .com .com .com .com .com 4 .com u datasheet
d7. this bit is not used fr. fringe background.this bit changes the back- ground from a box background to a fringe back- ground. the background is enabled by word as defined by either bg0 or bg1. a0o -the background is defined to be a box which is 7 x 9 dots. a1o -the background is defined to be a fringe. vsa5-vsa0. vertical start address. these bits determine the start position of the first line in the vertical direction. the 6 bits can specify 63 display start positions of interval 4h. the first start position will be the fourth line of the display. the vertical start address is defined vsa0 by the following for- mula. vertical start address = 4h(2 5 (vsa5) + 2 4 (vsa4) +2 3 (vsa3) + 2 2 (vsa2) + 2 1 (vsa1) + 2 0 (vsa0)) the case of all vertical start address bits being zero is illegal. d7. this bit is not used. sbd. space blanking disable. this bit controls whether or not the background is displayed when outputting spaces. if two background colours are used on adjacent words, then the background should not be displayed on spaces in order to make a nice break between colours. if an even background around an area of text is desired, as in a menu, then the background should be displayed when outputting spaces. a0o -the background during spaces is controlled by the background enable bits (bg0 and bg1) lo- cated in the background control register. a1o -the background is not displayed when output- ting spaces. hsa5, hsa0 - horizontal start address bits. these bits determine the start position of the first character in the horizontal direction. the 6 bits can specify 64 display start positions of interval 2/f osc or 400ns. the first start position will be at 4.0 m s be- cause of the time needed to access ram and rom before the first character can be displayed. the horizontal start address is defined by the fol- lowing formula. horizontal start address = 2/fosc(10.0 + 2 5 (hsa5) +2 4 (hsa4) + 2 3 (hsa3) + 2 2 (hsa2) + 2 1 (hsa1) + 2 0 (hsa0)) on-screen display (continued) vsar vertical start address register (10h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 vsa5-vsa0 = vertical start address bits fr = fringe backround control bit unused figure 60. vertical start address register hsar horizontal start address register (11h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 hsa5-hsa0 = horizontal start address bits sbd = space blanking disabled bit unuse d figure 61. horizontal start address register ? ST6391,92,93,95,97,99 47/64 .com .com .com .com .com 4 .com u datasheet
d7. this bit is not used scb. screen blanking. this bit allows the entire screen to be blanked. a0o -the blanking output signal (vblk) is active only when displaying characters. a1o -the blanking output signal (vblk) is always active. characters in the display ram are still displayed. when this bit is set to one, the screen is blanked also without setting the global enable bit to one (osd disabled). vs5 , vs0. vertical space. these bits determine the spacing between lines if the vertical space en- able bit (vse) in the format character is one. if vse is zero there will be no spaces between lines. the vertical space bits can specify one of 63 spacing values from 4h to 252h. the space between lines is defined by the following formula. space between lines = 4h(2 5 (vs5) + 2 4 (vs4) + 2 3 (vs3) + 2 2 (vs2) + 2 1 (vs1) + 2 0 (vs0)) the case of all vertical start address bits being zero is illegal. gs2,gs1. global size. these bits along with the size bit (s) located in the character format word specify the character size for each line as defined in table 13. table 13. horizontal space register size setting. gs2 gs1 s vertical height horizontal length 0 0 0 18h 6 tdot 0 0 1 36h 12 tdot 0 1 0 18h 6 tdot 0 1 1 54h 18 tdot 1 0 0 36h 12 tdot 1 0 1 54h 18 tdot 1 1 0 36h 12 tdot 1 1 1 72h 24 tdot note: tdot= 2/f osc hs5, hs0 . horizontal space . these bits deter- mine the spacing between words if the horizontal space enable bit (hse) located in the space char- acter is a one. the space between words is then equal to the width of the space character plus the number of tdots specified by the horizontal space bits. the 6 bits can specify one of 64 spacing val- ues ranging from 2/f osc to 128/f osc . the formula is shown below for the smallest size character(18h). if larger size characters are being displayed the spacing between words will increase proportion- ately. multiply the value below by 2, 3 or 4 for char- acter sizes of 36h, 54h and 72h respectively. space between words (not including the space character)=2/fosc(1+2 5 (hs5)+2 4 (hs4)+2 3 (hs3) +2 2 (hs2)+ 2 1 (hs1)+2 0 (hs0)) on-screen display (continued) vsr vertica l space register (12h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 vs5-vs0 = vertical space scb = screen blanking bit unused figure 62. vertical space register hsr horizontal space register (13h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 hs5-hs0 = horizontal space gs1 = global size bit 1 gs2 = global size bit 2 figure 63. horizontal space register ? ST6391,92,93,95,97,99 48/64 .com .com .com .com .com 4 .com u datasheet
background control register this register sets up two possible backgrounds. the background select bit (bgs) in the format or space character will determine which background is selected for the current word. r1,r0,g1,g0,b1,b0. background colour . these bits define the colour of the specified back- ground, either background 1 or background 0 as defined in table below. table 14. background register colour setting. rx gx bx colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white bk1,bk0. background enable.these bits deter- mine if the specified background is enabled or not. a0o -the following word does not have a background. a1o -there is a background around the following word. d7-d1. these bits are not used bs. bank select. this bit select the character bank to be used. the lower bank is selected with 0. the value can be modified only when the osd is off (ge=0). no reset value. osd data ram the contents of the data ram can be accessed by the st639x mcus only when the global enable bit (ge) in the global enable register is a zero. the first character in every line is the format char- acter. this character is not displayed. it defines the size of the characters in the line and contains the vertical space enable bit. this character also de- fines the colour, background and display enable for the first word in the line. subsequent characters are either spaces or one of the 64 available charac- ter types. the space character defines the colour, back- ground, display enable and horizontal space en- able for the following word. since there are 5 display lines of 15 characters each, the display ram must contain 5 lines x (15 characters + 1 for- mat character) or 80 locations. the ram size is 80 locations x 7 bits. the data ram map is shown in table 15. on-screen display (continued) bcr backround control register (14h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 bk0 = backround enable bit 0 bk1 = backround enable bit 1 b0 = b colour backround bit 0 b1 = b colour backround bit 1 g0 = g colour backround bit 0 g1 = g colour backround bit 1 r0 = r colour backround bit 0 r1 = r colour backround bit 1 figure 64. backround control register cbsr character bank select register (edh - no page , write only) d7 d6 d5 d4 d3 d2 d1 d0 bs = bank select bit unuse d figure 65. character bank select register ? ST6391,92,93,95,97,99 49/64 .com .com .com .com .com 4 .com u datasheet
column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 a0 0101010101010101 a1 0011001100110011 a2 0000111100001111 a3 0000000011111111 page a5 a4 line 5 0 0 1 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 0 1 2 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 1 0 3 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 1 1 4 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 6 0 0 5 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch available screen space table 15. osd ram map on-screen display (continued) notes: ft. the format character required for each line. characters in columns 1 thru 15 are displayed. ch. (byte) character (index into osd character generator) or space character emulator remarks there are a few differences between emulator and silicon. for noise reasons, the osd oscillator pins are not available: the internal oscillator cannot be disabled and replaced by an external coil. in the emulator, the character bank select register can be written also with global enable bit set, while this is not allowed in the device. application notes 1 - the osd character generator is composed of a dual port video ram and some circuitry. it needs two input signals vsync and hsync to syncron- ize its dedicated oscillator to the tv picture. it gen- erates 4 output signals, that can be used from the tv set to generate the characters on the screen. for instance, they can be used to feed the scart plug, providing an adequate buffer to drive the low impedance (75 w ) of the scart inputs. 2 - the core sees the osd as a number of ram locations (80) plus a certain number of control reg- isters (6). these 86 locations are mapped in two pages of the dynamic data ram address range (0h..3fh). in page 5 (load 20h in the register 0e8h), there are 64 bytes of ram, the ones of the first 4 rows (16 bytes each row, 15 characters per row maximum, plus an hidden leading formatcharacter). in page 6 (load 40h in register 0e8h), the 16 bytes of the fifth row (0..0fh), and the 6 control registers (10h..14h,17h). 3 - the video ram is a dual port ram. that means that it can be addressed either from the core or from the osd circuitry itself. to reduce the com- plexity of the circuitry, and thus its cost, some re- strictions have been introduced in the use of the osd. a. the core can only write to any of the 86 loca- tions (either video ram or control registers). b. the core can only write to any of the leading 85 locations when the osd oscillator is off. only the last location (control register 17h in page 6) can be addressed at any time. this is the global enable register, which contains only the ge bit. if it is set, the osd is on, if it is reset the osd is off. 4 - the timing of the on/off switching of the osd oscillator is the following: a. ge bit is set. the osd oscillator will start on the next vsync signal. b. ge bit is reset. the osd oscillator will be im- mediately switched off. ? ST6391,92,93,95,97,99 50/64 .com .com .com .com .com 4 .com u datasheet
to avoid a bad visual impression, it is important that the ge bit is set before the end of the flyback time when changing characters. this can be done inside the vsync interrupt routine. the following diagram can explain better: notes: a - picture time: 20 ms in pal/secam. b - vsync interrupt, if enabled. c - starting of osd oscillator, if ge = 1. d - flyback time. when modifying the picture display (i.e.: a bar graph for an analog control), it is important that the switching on of the ge bit is done before the the end of the flyback time (d in figure 66). if the ge bit is set after the end of the flyback time then the osd will not start until the begining of the next frame. this results in one frame being lost and will result in a flicker on the screen. one method to be sure to avoid the flicker is to wait for the vsync in- terrupt at the start of the flyback; once the vsync interrupt is detected, then the ge bit can be set to zero, the characters changed, and the ge set to one. all this should occur before the end of the fly- back time in order not to lose a frame. the correct edge of the interrupt must be chosen. on-screen display (continued) the vsync pin may alternatively be sampled by software in order to know the status; this can be done by reading bit 4 of register e4h; this bit is in- verted with respect to the vsync pin. 6 - an osd end of line bar is present in the st63p9x piggyback and st639x rom, eprom and otp devices when using the background mode. if this bar is present with software running in the piggybacks then it is also present on the rom mask version. if the end of line bar is seen to be eliminated by software in the piggyback, then it is also be eliminated in the rom mask version. the bar appears at the end of the line in the back- ground mode when the last character is a space character, the first format character is defined with s=0 (size 0)and the backround is not displayed during the space. the bar is the colour of the back- ground defined by the space character. to elimi- nate the bar: a. if two backgrounds are used then the bar should be moved off the screen by using large word spaces instead of character spaces. if there are not enough spaces before the end of the line, then the location of the valid charac- ters should be moved so they appear at the end of the line (and hence no bar); positioning can be compensated using the horizontal start register. b. if only one background is used, then the other background should be transparent in order to eliminate the bar. 7 - the osd oscillator external network should consist of a capacitor on each of the osd oscillator pins to ground together with an inductance be- tween pins. the user should select the two capaci- tors to be the same value (15pf to 25pf each is recommended). the inductance is chosen to give the desired osd oscillator frequency for the appli- cation (typically 56 m h). figure 66. osd oscillator on/off timing ? ST6391,92,93,95,97,99 51/64 .com .com .com .com .com 4 .com u datasheet
software description the st63xx software has been designed to fully use the hardware in the most efficient way possible while keeping byte usage to a minimum; in short to provide byte efficient programming capability. the st63xx core has the ability to set or clear any register or ram location bit of the data space with a single instruction. furthermore, the program may branch to a selected address depending on the status of any bit of the data space. the carry bit is stored with the value of the bit when the set or res instruction is processed. addressing modes the st63xx core has nine addressing modes which are described in the following paragraphs. the st63xx core uses three different address spaces : program space, data space, and stack space. program space contains the instructions which are to be executed, plus the data for imme- diate mode instructions. data space contains the accumulator, the x,y,v and w registers, peripheral and input/outputregisters, the ram locations and data rom locations (for storage of tables and constants). stack space contains six 12-bit ram cells used to stack the return addresses for subrou- tines and interrupts. immediate. in the immediate addressing mode, the operand of the instruction follows the opcode location. as the operand is a rom byte, the imme- diate addressing mode is used to access constants which do not change during program execution (e.g., a constant used to initialize a loop counter). direct. in the direct addressing mode, the address of the byte that is processed by the instruction is stored in the location that follows the opcode. direct addressing allows the user to directly address the 256 bytes in data space memory with a single two-byte instruction. short direct. the core can address the four ram registers x,y,v,w (locations 80h, 81h, 82h, 83h) in the short-direct addressing mode. in this case, the instruction is only one byte and the selection of the location to be processed is contained in the opcode. short direct addressing is a subset of the direct addressing mode. (note that 80h and 81h are also indirect registers). extended. in the extended addressing mode, the 12-bit address needed to define the instruction is obtained by concatenating the four less significant bits of the opcode with the byte following the op- code. the instructions (jp, call) that use the extended addressing mode are able to branch to any address of the 4k bytes program space. an extended addressing mode instruction is two- byte long. program counter relative. the relative address- ing mode is only used in conditional branch instruc- tions. the instruction is used to perform a test and, if the condition is true, a branch with a span of -15 to +16 locations around the address of the relative instruction. if the condition is not true, the instruc- tion that follows the relative instruction is executed. the relative addressing mode instruction is one- byte long. the opcode is obtained in adding the three most significant bits that characterize the kind of the test, one bit that determines whether the branch isa forward (when it is 0) or backward (when it is 1) branch and the four less significant bits that give the span of the branch (0h to fh) that must be added or subtracted to the address of the relative instruction to obtain the address of the branch. bit direct. in the bit direct addressing mode, the bit to be set or cleared is part of the opcode, and the byte following the opcode points to the address of the byte in which the specified bit must be set or cleared. thus, any bit in the 256 locations of data space memory can be set or cleared. bit test & branch. the bit test and branch ad- dressing mode is a combination of direct address- ing and relative addressing. the bit test and branch instruction is three-byte long. the bit identification and the tested condition are included in the opcode byte. the address of the byte to be tested follows immediately the opcode in the program space. the third byte is the jump displacement, which is in the range of -126 to +129. this displacement can be determined using a label, which is converted by the assembler. indirect. in the indirect addressing mode, the byte processed by the register-indirect instruction is at the address pointed by the content of one of the indirect registers, x or y (80h,81h). the indirect register is selected by the bit 4 of the opcode. a register indirect instruction is one byte long. inherent. in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. these instructions are one byte long. ? ST6391,92,93,95,97,99 52/64 .com .com .com .com .com 4 .com u datasheet
software description (continued) instruction set the st63xx core has a set of 40 basic instruc- tions. when these instructions are combined with nine addressing modes, 244 usable opcodes can be obtained. they can be divided into six different types:load/store, arithmetic/logic, conditional branch, control instructions, jump/call, bit manipu- lation. the following paragraphs describe the dif- ferent types. all the instructions within a given type are pre- sented in individual tables. load & store. these instructions use one,two or three bytes in relation with the addressing mode. one operand is the accumulator for load and the other operand is obtained from data memory using one of the addressing modes. for load immediate one operand can be any of the 256 data space bytes while the other is always immediate data. see table 16. instruction addressing mode bytes cycles flags zc ld a, x short direct 1 4 d * ld a, y short direct 1 4 d * ld a, v short direct 1 4 d * ld a, w short direct 1 4 d * ld x, a short direct 1 4 d * ld y, a short direct 1 4 d * ld v, a short direct 1 4 d * ld w, a short direct 1 4 d * ld a, rr direct 2 4 d * ld rr, a direct 2 4 d * ld a, (x) indirect 1 4 d * ld a, (y) indirect 1 4 d * ld (x), a indirect 1 4 d * ld (y), a indirect 1 4 d * ldi a, #n immediate 2 4 d * ldi rr, #n immediate 3 4 * * notes: x,y. indirect register pointers, v & w short direct registers # . immediate data (stored in rom memory) rr. data space register d . affected * . not affected table 16. load & store instructions ? ST6391,92,93,95,97,99 53/64 .com .com .com .com .com 4 .com u datasheet
software description (continued) arithmetic and logic. these instructions are used to perform the arithmetic calculations and logic operations. in and, add, cp, sub instruc- tions one operand is always the accumulatorwhile the other can be either a data space memory content or an immediate value in relation with the addressing mode. in clr, dec, inc instructions the operand can be any of the 256 data space addresses. in com, rlc, sla the operand is always the accumulator. see table 17. instruction addressing mode bytes cycles flags zc add a, (x) indirect 1 4 dd add a, (y) indirect 1 4 dd add a, rr direct 2 4 dd addi a, #n immediate 2 4 dd and a, (x) indirect 1 4 d * and a, (y) indirect 1 4 d * and a, rr direct 2 4 d * andi a, #n immediate 2 4 d * clr a short direct 2 4 dd clr rr direct 3 4 * * com a inherent 1 4 dd cp a, (x) indirect 1 4 dd cp a, (y) indirect 1 4 dd cp a, rr direct 2 4 dd cpi a, #n immediate 2 4 dd dec x short direct 1 4 d * dec y short direct 1 4 d * dec v short direct 1 4 d * dec w short direct 1 4 d * dec a direct 2 4 d * dec rr direct 2 4 d * dec (x) indirect 1 4 d * dec (y) indirect 1 4 d * inc x short direct 1 4 d * inc y short direct 1 4 d * inc v short direct 1 4 d * inc w short direct 1 4 d * inc a direct 2 4 d * inc rr direct 2 4 d * inc (x) indirect 1 4 d * inc (y) indirect 1 4 d * rlc a inherent 1 4 dd sla a inherent 2 4 dd sub a, (x) indirect 1 4 dd sub a, (y) indirect 1 4 dd sub a, rr direct 2 4 dd subi a, #n immediate 2 4 dd notes: x,y. indirect register pointers, v & w short direct registers d . affected # . immediate data (stored in rom memory) * . not affected rr. data space register table 17. arithmetic & logic instructions ? ST6391,92,93,95,97,99 54/64 .com .com .com .com .com 4 .com u datasheet
software description (continued) conditional branch. the branch instructions achieve a branch in the program when the selected condition is met. see table 18. bit manipulationinstructions. these instructions can handle any bit in data space memory. one group either sets or clears. the other group (see conditional branch) performs the bit test branch operations. see table 19. control instructions. the control instructions control the mcu operations during program execu- tion. see table 20. jump and call. these two instructions are used to perform long (12-bit) jumps or subroutines call inside the whole program space. refer to table 21. instruction branch if bytes cycles flags zc jrc e c = 1 1 2 * * jrnc e c = 0 1 2 * * jrz e z = 1 1 2 * * jrnz e z = 0 1 2 * * jrr b, rr, ee bit = 0 3 5 * d jrs b, rr, ee bit = 1 3 5 * d notes: b. 3-bit address rr. data space register e. 5 bit signed displacement in the range -15 to +16 d . affected ee. 8 bit signed displacement in the range -126 to +129 * . not affected table 18. conditional branch instructions instruction addressing mode bytes cycles flags zc set b,rr bit direct 2 4 * * res b,rr bit direct 2 4 * * notes: b. 3-bit address; * . not affected rr. data space register; table 19. bit manipulation instructions instruction addressing mode bytes cycles flags zc nop inherent 1 2 * * ret inherent 1 2 * * reti inherent 1 2 dd stop (1) inherent 1 2 * * wait inherent 1 2 * * notes: 1. this instruction is deactivated and a waitis automatically executed instead of a stop if the hardware activated watchdog function is selected. d . affected * . not affected table 20. control instructions instruction addressing mode bytes cycles flags zc call abc extended 2 4 * * jp abc extended 2 4 * * notes: abc.12-bit address; * . not affected table 21. jump & call instructions ? ST6391,92,93,95,97,99 55/64 .com .com .com .com .com 4 .com u datasheet
software description (continued) opcode map summary. the following table containsan opcode map for the instructions used on the mcu. low 01234567 0000 0001 0010 0011 010 0 0101 0110 0111 hi 0 00 00 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld e abc e b0 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 1 00 01 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 ldi e abc e b0 ,rr,ee e x e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 2 00 10 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 cp e abc e b4 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 3 0011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 cpi e abc e b4 ,rr,ee e a,x e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 4 01 00 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 add e abc e b2 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 5 0101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 addi e abc e b2 ,rr,ee e y e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 6 0110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 inc e abc e b6 ,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 7 0111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc e abc e b6 ,rr,ee e a,y e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 8 1000 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld e abc e b1 ,rr,ee e # e (x),a 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 9 1001 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc e abc e b1 ,rr,ee e v e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc a 1010 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 and e abc e b5 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind b 1011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 andi e abc e b5 ,rr,ee e a,v e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm c 1100 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 sub e abc e b3 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind d 1101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 subi e abc e b3 ,rr,ee e w e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm e 1110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 dec e abc e b7 ,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind f 1111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc e abc e b7 ,rr,ee e a,w e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc low 89 abcdef 10 00 1001 1010 1011 1100 1101 1110 1111 hi 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 ldi 2 jrc 4 ld 0 0000 e abc e b0 ,rr e rr,nn e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 3 imm 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 1 0001 e abc e b0 ,rr e x e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 com 2 jrc 4 cp 2 0010 e abc e b4 ,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 cp 3 0011 e abc e b4 ,rr e x,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d. 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 reti 2 jrc 4 add 4 0100 e abc e b2 ,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 add 5 0101 e abc e b2 ,rr e y e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 stop 2 jrc 4 inc 6 0110 e abc e b6 ,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 inc 7 0111 e abc e b6 ,rr e y,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 jrc 4 ld 8 1000 e abc e b1 ,rr e # e (y),a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 9 1001 e abc e b1 ,rr e v e rr,a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 rlc 2 jrc 4 and a 1010 e abc e b5 ,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 and b 1011 e abc e b5 ,rr e v,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 ret 2 jrc 4 sub c 1100 e abc e b3 ,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 sub d 1101 e abc e b3 ,rr e w e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 wait 2 jrc 4 dec e 1110 e abc e b7 ,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 dec f 1111 e abc e b7 ,rr e w,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir abbreviations for addressing modes: legend: dir direct # indicates illegal instructions sd short direct e 5 bit displacement imm immediate b 3 bit address inh inherent rr1byte dataspace address ext extended nn 1 byte immediate data b.d bit direct abc 12 bit address bt bit test ee 8 bit displacement pcr program counter relative ind indirect cycles 2 jrc mnemonic operand e bytes 1 pcr addressing mode ? ST6391,92,93,95,97,99 56/64 .com .com .com .com .com 4 .com u datasheet
absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, how- ever it is advised to take normal precaution to avoid application of any voltage higher than maximum rated voltages. for proper operation it is recommended that v i and v o must be higher than v ss and smaller than v dd . reliability is enhanced if unused inputs are con- nected to an appropriated logic voltage level (v dd or v ss ). power considerations. the average chip-junc- tion temperature, tj, in celsius can be obtained from : tj = t a + pd x rthja where :t a = ambient temperature. rthja = package thermal resistance (junction-to ambient). pd = pint + pport. pint = i dd xv dd (chip internal power). pport = port power dissipation (determinated by the user). symbol parameter value unit v dd supply voltage -0.3 to 7.0 v v i input voltage (afc in) v ss - 0.3 to +13 v v i input voltage (other inputs) v ss - 0.3 to v dd +0.3 v v o output voltage (pa4-pa7, pc4-pc7, da0-da5) v ss - 0.3 to +13 v v o output voltage (other outputs) v ss - 0.3 to v dd +0.3 v i o current drain per pin excluding v dd ,v ss , pa6, pa7 10 ma i o current drain per pin (pa6, pa7) 50 ma iv dd total current into v dd (source) 50 ma iv ss total current out of v ss (sink) 150 ma tj junction temperature 150 c t stg storage temperature -60 to 150 c note : stresses above those listed as aabsolute maximum ratingso may cause permanent damage to the device . this is a stress rating only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. symbol parameter test conditions value unit min. typ. max. rthja thermal resistance psdip42 67 c/w thermal characteristic symbol parameter test conditions value unit min. typ. max. t a operating temperature 1 suffix version 0 70 c v dd operating supply voltage 4.5 5.0 6.0 v f osc oscillator frequency run & wait modes 8 8.1 mhz f osdosc on-screen display oscillator frequency 8.0 mhz recommended operating conditions ? ST6391,92,93,95,97,99 57/64 .com .com .com .com .com 4 .com u datasheet
eeprom information the st63xx eeprom single poly process has been specially developed to achieve 300.000 write/erase cycles and a 10 years data retention. symbol parameter test conditions value unit min. typ. max. v il input low level voltage all i/o pins 0.2xv dd v v ih input high level voltage all i/o pins 0.8xv dd v v hys hysteresis voltage(1) all i/o pins v dd =5v 1.0 v v ol low level output voltage da0-da5, pb0-pb6, osd outputs, pc0-pc7, o0, o1, pa0-pa5 v dd = 4.5v i ol = 1.6ma i ol = 5.0ma 0.4 1.0 v v v ol low level output voltage pa6-pa7 v dd = 4.5v i ol = 1.6ma i ol = 25ma 0.4 1.0 v v v ol low level output voltage osdoscout, oscout v dd = 4.5v i ol = 0.4ma 0.4 v v oh high level output voltage pb0-pb7, pa0-pa3, osd outputs v dd = 4.5v i oh = 1.6ma 4.1 v v oh high level output voltage osdoscout, oscout, v dd = 4.5v i oh = 0.4ma 4.1 v i pu input pull up current input mode with pull-up pb0-pb6, pa0-pa3, pc0- pc3 v in =v ss 100 50 25 ma i il i ih input leakage current oscin v in =v ss v in =v dd 10 0.1 1 1 0.1 10 m a i il input pull-down current in reset oscin 100 m a i il i ih input leakage current all i/o input mode no pull-up osdoscin v in =v dd or v ss 10 10 m a v dd ram ram retention voltage in reset 1.5 v i il i ih input leakage current reset pin with pull-up v in =v ss 50 30 10 m a i il i ih input leakage current afc pin v ih =v dd v il =v ss v ih = 12.0v 1 1 40 m a dc electrical characteristics (t a = 0 to +70 c unless otherwise specified) ? ST6391,92,93,95,97,99 58/64 .com .com .com .com .com 4 .com u datasheet
symbol parameter test conditions value unit min. typ. max. i oh output leakage current da0-da5, pa4-pa5, pc0-pc7, o0, o1 v oh =v dd 10 m a i oh output leakage current high voltage da0-da5, pa4-pa7, pc4- pc7, o0, o1 v oh = 12v 40 m a i dd supply current run mode f osc = 8mhz, iload= 0ma v dd = 6.0v 616ma i dd supply current wait mode f osc = 8mhz, iload= 0ma v dd =6v 310ma i dd supply current at transition to reset f osc = not app, iload= 0ma v dd =6v 0.1 1 ma v on reset trigger level on reset pin 0.3xv dd v v off reset trigger level off reset pin 0.8xv dd v v ta input level absolute tolerance a/d afc pin v dd =5v 200 mv v tr input level relatice tolerance (1) a/d afc pin relative to other levels v dd =5v 100 mv note : 1. not 100% tested dc electrical characteristics (continued) ? ST6391,92,93,95,97,99 59/64 .com .com .com .com .com 4 .com u datasheet
symbol parameter test conditions value unit min. typ. max. t wres minimum pulse width reset pin 125 ns to hl high to low transition time pa6, pa7 v dd = 5v, cl = 1000pf (2) 100 ns to hl high to low transition time da0-da5, pb0-pb6, osd outputs, pc0-pc7, v dd = 5v, cl = 100pf 20 ns to lh low to high transition time pb0-pb6, pa0-pa3, osd outputs, pc0-pc3 v dd = 5v, cl = 100pf 20 ns to h data hold time spi after clock goes low i 2 cbus/s-bus only all devices 750 ns f da d/a converter repetition frequency (1) ST6391,92,93,99 st6395,97 31.25 25 khz f sio sio baud rate (1) ST6391,92,93,99 st6395,97 62.50 100 khz t wee eeprom write time t a =25 c one byte 5 10 ms endurance eeprom write/erase cycles q a l ot acceptance criteria 300.000 >1 million cycles retention eeprom data retention (4) t a =25 c 10 years c in input capacitance (3) all inputs pins 10 pf c out output capacitance (3) all outputs pins 10 pf coscin, coscout oscillator pins internal capacitance(3) 5pf cosdin, cosdout osd oscillator external capacitance recommended 15 25 pf notes: 1. a clock other than 8 mhz will affect the frequency response of those peripherals (d/a, 62.5khz and spi) whose clock is derived from the system clock. 2. the rise and fall times of port a have been reduced in order to avoid current spikes while maintaining a high drive capability 3. not 100% tested 4. based on extrapolated data ac electrical characteristics (t a = 0 to +70 c, f osc =8mhz, v dd =4.5 to 6.0v unless otherwise specified ) ? ST6391,92,93,95,97,99 60/64 .com .com .com .com .com 4 .com u datasheet
package mechanical data figure 67. st639x 42 pin plastic dual-in-line package dim. mm inches min typ max min typ max a 5.08 0.200 a1 0.51 0.020 b 0.35 0.59 0.014 0.023 b1 0.75 1.42 0.030 0.056 c 0.20 0.36 0.008 0.014 d 36.32 39.12 1.430 1.540 d1 e 18.54 0.730 e1 13.72 0.540 k1 k2 l 2.54 3.81 .100 0.150 e1 1.78 0.070 number of pins n42 ordering information the following chapter deals with the procedure for transfer the program/data rom codes to sgs- thomson. communication of the rom codes. to commu- nicate the contents of program /data rom memo- ries to sgs-thomson, the customer has to send a 5o diskette with: one file in intel intellec 8/mds format for the program memory one file in intel intellec 8/mds format for the odd and even odd osd characters one file in intel intellec 8/mds format for the eeprom initial content (this file is optional) a filled option list form as described in the option list paragraph. the program rom should respect the rom mem- ory map as in table 22. the rom code must be generated with st6 as- sembler. before programming the eprom, the buffer of the eprom programmer must be filled with ffh. ? ST6391,92,93,95,97,99 61/64 .com .com .com .com .com 4 .com u datasheet
customer eeprom initial contents: format a. the content should be written into an intel intellec format file. b. in the case of 384 bytes of eeprom, the start- ing addressis 000h and the end address is 7fh. the order of the pages (64 bytes each) is an in the specification (ie. b7, b1 b0: 001, 010, 011, 101, 110. 111). c. undefined or don't care bytes should have the content ffh. osd test character. in order to allow the testing of the on-chip osd macrocell the following character must be pro- vided at the fixed 3fh (63) position of the second osd bank. listing generation & verification. when sgs- thomson receives the files, a computer listing is generated from them. this listing refers extractly to the mask that will be used to produce the microcon- troller. then the listing is returned to the customer figure 68. osd test character rom page device address eprom address (1) description page 0 0000h-007fh 0080h-07ffh 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh 1000h-100fh 1010h-17ffh reserved user rom page 3 0000h-000fh 0010h-07ffh 1800h-180fh 1810h-1fffh reserved user rom page 4 0000h-000fh 0010h-07ffh 2000h-200fh 2010h-27ffh reserved user rom page 5 0000h-000fh 0010h-07ffh 2800h-280fh 2810h-2fffh reserved user rom page 6 0000h-000fh 0010h-07ffh 3000h-300fh 3010h-37ffh reserved user rom page 7 0000h-000fh 0010h-07ffh 3800h-380fh 3810h-3fffh reserved user rom (end of 16k) page 8 0000h-000fh 0010h-07ffh 4000h-400fh 4010h-47ffh reserved user rom page 9 0000h-000fh 0010h-07ffh 4800h-480fh 4810h-4fffh reserved user rom (end of 20k) note 1. eprom addresses are related to the use of st63p9x piggyback emulation devices. table 22. rom memory map that must thoroughly check, complete, sign and return it to sgs-thomson. the signed list consti- tutes a part of the contractual agreement for the creation of the customer mask. sgs-thomson sales organization will provide detailed information on contractual points. ? ST6391,92,93,95,97,99 62/64 .com .com .com .com .com 4 .com u datasheet
st639x microcontroller option list customer: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . address: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . contact: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . phone no: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . reference: . . . . . . . . . . . . ............................. device [ ] (d) package [ ] (p) temperature range [ ] (t) for marking one line with 10 characters maximum is possible special marking [ ] (y/n) line1 a _ _ _ _ _ _ _ _ _ _ o (n) notes: (d) 1= ST6391, 2 = st6392, 3 = st6393, 4 = st6395, 5 = st6397, 6 = st6399 (p) b= dual in line plastic (t) 1= 0 to 70 c (n) letters, digits, ' . ', ' - ', ' / ' and spaces only marking: the default marking is equivalent to the sales type only (part number). osd polarity options (put a cross on selected item) : positive negative vsync,hsync [ ] [ ] r,g,b [ ] [ ] blank [ ] [ ] check list: yes no rom code [ ] [ ] osd code: odd & even [ ] [ ] eeprom code (if desired) [ ] [ ] signature ................................... date ........................................... ? ST6391,92,93,95,97,99 63/64 .com .com .com .com .com 4 .com u datasheet
information furnished is believed to be accurate and reliable. however, sgs-thomson microelectronics assumes no responsability for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of sgs-thomson microelectronics. specifications mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied. sgs-thomson microelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of sgs-thomson microelectronics. ? 1994 sgs-thomson microelectronics - all rights reserved. purchase of i2c components by sgs-thomson microelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i2c standard specification as defined by philips. sgs-thomson microelectronics group of companies australia - brazil - france - germany - hong kong - italy - japan - korea - malaysia - malta - morocco - the netherlands singapore - spain - sweden - switzerland - taiwan - thailand - united kingdom - u.s.a. sales type rom/eeprom size temperature range package ST6391b1/xx 16k/128 bytes 0 to + 70 c psdip42 st6392b1/xx 20k/128 bytes 0 to + 70 c psdip42 st6393b1/xx 16k/128bytes 0 to + 70 c psdip42 st6395b1/xx 20k/384 bytes 0 to + 70 c psdip42 st6397b1/xx 20k/384 bytes 0 to + 70 c psdip42 st6399b1/xx 16k/128 bytes 0 to + 70 c psdip42 note: axxo is the rom code identifier that is allocated by sgs-thomson after receipt of all required options and the related rom file. ordering information table ? ST6391,92,93,95,97,99 64/64 .com .com .com .com 4 .com u datasheet


▲Up To Search▲   

 
Price & Availability of ST6391

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X